Re: @property and Garbage Collection
Re: @property and Garbage Collection
- Subject: Re: @property and Garbage Collection
- From: Quincey Morris <email@hidden>
- Date: Tue, 25 Jan 2011 03:00:13 -0800
On Jan 25, 2011, at 02:15, Kevin Bracey wrote:
> 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
It's a not-quite-bug in the compiler. The compiler helpfully assumes that if the property value class implements NSCopying, then it's an immutable value (like NSString), and therefore the 'copy' attribute should be specified (instead of the default 'assign' -- and remember that 'assign' and 'retain' are the same thing under GC).
The problem is that this assumption is not necessarily true, not even most of the time. For many classes, it's irrelevant to their mutability whether they implement NSCopying or not.
So, if specify 'copy' if that's what you want, otherwise specify 'assign' explicitly to shut the compiler up.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden