CFBridgingRetain() and CFBridgingRelease() should to exactly what the
__bridge_retained and __bridge_transfer compiler directives do, so an
insight on how the libobjc2 ARC runtime handles this case will
probably give us an answer.

However, according to Mike Ash[1] in an article from 2011 on the dawn of ARC,

> CFStringRef valueCF = CFPreferencesCopyAppValue(CFSTR("someKey"), 
> CFSTR("com.company.someapp"));
> NSString *value = (__bridge NSString *)valueCF;
> CFRelease(valueCF);
> [self useValue: value];

is functionally equivalent to:

> NSString *value = 
> CFBridgingRelease(CFPreferencesCopyAppValue(CFSTR("someKey"), 
> CFSTR("com.company.someapp")));
> [self useValue: value];

So it seems to me logically that the behavior of CFBridgingRelease()
should be that of reducing the reference count of the object but not
deallocate it if it reaches zero, assuming ARC will immediately add
one to the reference count when the CF type becomes an Objective-C
object.

As for CFBridgingRetain(), the same effect will be attained anyway if
we CFRetain() when ARC releases everything on ObjC-land, but I wonder
if it should do anything else.

[1]: 
https://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html

_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to