Appropriateness of assign attribute and -fobj-gc-only
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