Re: Retain/Release and Properties clarification
Re: Retain/Release and Properties clarification
- Subject: Re: Retain/Release and Properties clarification
- From: Matt Neuburg <email@hidden>
- Date: Tue, 11 Oct 2011 09:57:26 -0700
On Fri, 07 Oct 2011 19:46:17 -0400, Andy Lee <email@hidden> said:
>On Oct 3, 2011, at 2:23 PM, Charles Srstka wrote:
>> 2. KVOs access instance variables directly (mis)feature recognizes the underscore prefix. I like to give it a prefix that KVO doesnt know about so that I can be sure never to end up accidentally accessing the ivars of another object without going through the proper accessors.
>
>Ooh, hadn't thought of that.
>
>Maybe now's the time to start using spiffy compiler features like synthesized ivars, and to stop declaring ivars at all.
But please insert here some boilerplate grumbling about the vast undocumented namespace in which you're operating. I did everything "right" when I named an ivar "firstResponder" (property, synthesized ivar, synthesized accessors) and totally broke my app because Apple was apparently already using an undocumented ivar called "firstResponder".
http://www.cocoabuilder.com/archive/cocoa/296662-assign-property-behaves-differently-from-simple-instance-variable.html
Also, note that there are circumstances where a synthesized ivar won't work; see, for instance, this note:
http://www.cocoabuilder.com/archive/cocoa/298320-inherited-implicitly-created-member-is-no-member.html
m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
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