Kevin Bracey <mailto:ke...@ilike.co.nz> wrote (Tuesday, January 25, 2011 2:59 AM +1300):

In a Garbage Collected App when using the @property is it correct that I still
have to specify (copy) or (retain) or have I missed something? I thought using
GC didn't require retain and that everything could just be assigned, but the
complier complains.

You're correct; GC doesn't require retain, and retain in a GC environment is a no-op.

In general, however, I'd suggest ignoring whether the environment is GC or not. Specify assign, copy, or retain based on the usage pattern of the property. That way, if you find yourself in a non-GC environment, it will still work.

While I write my properties this way, I may omit the retain/release messages in my code if I'm _sure_ it will never see a non-GC environment. But even when I'm writing a GC application, if the classes have utility beyond this application, and there's a reasonable chance that I'd like to use them in a non-GC environment, I'll write full retain/release code so that's functional in both.

--
James Bucanek

_______________________________________________

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