• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: @property and Garbage Collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >@property and Garbage Collection (From: Kevin Bracey <email@hidden>)
 >Re: @property and Garbage Collection (From: Thomas Davie <email@hidden>)
 >Re: @property and Garbage Collection (From: Kevin Bracey <email@hidden>)

  • Prev by Date: Re: WebKit WebArchive Create but no Load?
  • Next by Date: Re: Disable (grey out) main menu when displaying modal window?
  • Previous by thread: Re: @property and Garbage Collection
  • Next by thread: Re: @property and Garbage Collection
  • Index(es):
    • Date
    • Thread