On Oct 15, 2011, at 8:20 PM, Roland King wrote:
> I don't think I want either __bridge_transfer or __bridge_retained, the 
> former is for passing things back to obj-c classes and the latter I believe 
> effectively transfers ownership and would require an extra CFRelease() which 
> isn't going to happen, I don't want to transfer ownership, the dictionary 
> will take its own ownership. 

If you are familiar with retain/release logic then you may find that 
CFBridgingRetain() and CFBridgingRelease() make more sense than 
__bridge_transfer and __bridge_retained.

CFBridgingRetain() converts id to void* and retains it. You must balance it 
with a subsequent CFRelease() or CFBridgingRelease(). Let ARC do what it wants 
with the id side.

CFBridgingRelease() converts void* to id and releases it. You must balance it 
with a prior CFRetain() or CFBridgingRetain() or CFCreate(). Let ARC do what it 
wants with the id side.

__bridge cast converts id to void* or void* to id with no retain count changes. 


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to