cocoa - Does Foundation use Core Foundation? -
to me doesn't seem it. of course don't have sources of foundation, in case of gnustep, take example.
they have nsarray code https://github.com/gnustep/libs-base/blob/master/source/nsarray.m
nowhere in source refer cfarray.
https://github.com/gnustep/libs-corebase/blob/master/source/cfarray.c
same goes cf counterparts. why?
gnustep not same apple's foundation. don't know how gnustep implemented, in apple's foundation, ns , cf counterparts closely linked indeed. say, don't have source foundation, there still many ways detect integration between two. 1 easy-to-spot 1 inspect class of many foundation objects:
nsmutablestring *string = @"foo".mutablecopy; nslog(@"%@", nsstringfromclass(string.class));
this little program outputs __nscfstring
, clue cfstring
's implementation indeed being used under hood. specifically, nsstring
, cfstring
(as nsarray
, cfarray
, nsdictionary
, cfdictionary
, , many other foundation , cf types) toll-free bridged—this means internal structures designed same, such can convert 1 other simple typecast, no expensive conversion process. nsarray
doesn't use cfarray
, is cfarray
.
of course, since it's allowed make own private subclasses of classes nsstring
, nsarray
, et al., means bridging work, cf functions need able handle case looks cf object objective-c subclass, , use objective-c implementation if is. , reason, corefoundation objects, do have of sources to, make many references ns equivalents, such cfarray
source linked below, contains references nsarray
.
https://opensource.apple.com/source/cf/cf-1153.18/cfarray.c.auto.html
Comments
Post a Comment