• 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
Appropriateness of assign attribute and -fobj-gc-only
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Appropriateness of assign attribute and -fobj-gc-only


  • Subject: Appropriateness of assign attribute and -fobj-gc-only
  • From: Rick Mann <email@hidden>
  • Date: Sun, 21 Sep 2008 14:04:19 -0700

According to the Obj-C 2.0 docs:

assign
Specifies that the setter uses simple assignment. This is the default.

If your application uses garbage collection, if you want to use assign for a property whose class adopts the NSCopying protocol you should specify the attribute explicitly rather than simply relying on the default—otherwise you will get a compiler warning. (This is to reassure the compiler that you really do want to assign the value, even though it’s copyable.)


But the warning is:

"warning: 'assign' attribute on property 'portName' which implements 'NSCopying' protocol not appropriate with -fobjc-gc-only"

So, is it really inappropriate? It seems very appropriate to assign the pointer rather than allocate a new object and copy it, especially for immutable objects.

TIA,

--
Rick

_______________________________________________

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


  • Follow-Ups:
    • Re: Appropriateness of assign attribute and -fobj-gc-only
      • From: "Michael Ash" <email@hidden>
    • Re: Appropriateness of assign attribute and -fobj-gc-only
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: How to load a window
  • Next by Date: Re: How to load a window
  • Previous by thread: How to load a window
  • Next by thread: Re: Appropriateness of assign attribute and -fobj-gc-only
  • Index(es):
    • Date
    • Thread