On Aug 8, 2011, at 11:43 PM, Roland King wrote:

> After a bit of googling I came across some posts which explained Block_Copy() 
> would treat a variable adorned with __attribute__((NSObject)) similarly to 
> NSObjects and retain them. So changing the method signature to this 
> 
>       -(void)convert:(__attribute__((NSObject))CGImageRef)image 
> withBlock:(ImageResizedBlock)callbackBlock
> 
> appears to do the right thing in my testing, the CGImageRef is CFRetain()ed 
> when the block is enqueued and I assume CFRelease()d later. I prefer this 
> syntax, as I find it self-documenting;
> 
> I can't find anywhere apart from blog posts and the block specification 
> itself which says this works. Does anyone know if it's officially supported, 
> for gcc and clang and something that apple is likely to support going forward 
> into ARC

The ARC specification defines a "retainable pointer" as including those 
pointers that have the __attribute__((NSObject)) decoration, so this should 
behave as expected under ARC. 
<http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects>
--
David Duncan

_______________________________________________

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