On Jan 25, 2011, at 2:15 AM, Kevin Bracey wrote:
> Yes, I can see the the rule for copy, I'm guessing it still makes a copy.
> 
> I'm a little confused as to what ( retain ) now does, does it now also do a 
> copy, If I remove the ( copy ) I get
> warning: default 'assign' attribute on property 'allImportHeaders' which 
> implements 'NSCopying' protocol not appropriate with -fobjc-gc-only

(retain) and (assign) are identical under GC. (copy) still calls the -copy 
method.


> so I'm unsure should I use the retain or copy keyword for the objects that 
> conform to the 'NSCopying' protocol?


That depends on how your code should behave. Sometimes you want (assign) and 
sometimes you want (copy), even though GC is on. 

When the compiler sees a class that conforms to NSCopying, it requires you to 
explicitly write what you want instead of giving you (assign) by default. The 
hope is that the extra prompt to think about your code and maybe avoid a bug is 
worth the extra keystrokes. 


-- 
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