On Thu, 19 Jul 2012 09:43:12 +1000, Shane Stanley said: >> But you can prepare your code slowly, in a way that supports both. ex: >> - replace all use of NSAllocateCollectable with malloc/free >> - change 'retain' to 'strong' in property declarations >> - replace CFMakeCollectable with CFBridgingRelease >> - replace NSMakeCollectable with a nil check and CFBridgingRelease > >Thanks -- I didn't realize the last two. > >So you are saying I can include things like __bridge and >__bridge_retained in GC code, and they'll just be ignored until I flick >the switch?
Actually, I wasn't saying that. If you look in the header at how CFBridgingRelease is defined: #if __has_feature(objc_arc) NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) { return (__bridge_retained CFTypeRef)X; } #else NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) { return [(id)CFMakeCollectable(X) autorelease]; } #endif you see that it does the expected thing in either GC or ARC. Very useful. Just beware passing nil, which is ok with NSMakeCollectable but not so at the CF layer. -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com