On Thu, May 20, 2010 at 5:44 AM, Joanna Carter
<cocoa...@carterconsulting.org.uk> wrote:
> Le 20 mai 2010 à 13:24, Alexander Spohr a écrit :
> Yes, because the ivar is synthesised, addressing myFoo would send the release 
> message to the property, which is not recommended.

No. "Send the release message to the property" is a meaningless
phrase. Only objects can receive release messages, and the property
accessor returns the same address that is stored in the ivar, so the
same object would receive the -release message. Also, property
accessors are only called with either dot or method syntax; plain old
`myFoo = bar` will not call -setFoo:.

> Apparently, self->myFoo is capable of reaching the synthesised ivar.

Alexander is correct that plain old `myFoo` will also access the
synthesized ivar. There used to be a GCC bug in which synthesized
ivars were inaccessible (at least through self-> syntax; now I can't
recall whether they were wholly inaccessible). That, combined with the
fact that there is no declaration of the ivar in scope, has led me to
always use self-> syntax. I can't even recall seeing it documented
that @synthesize myFoo; puts the myFoo symbol in scope; if it has ever
been documented, I can't find it now.

--Kyle Sluder
_______________________________________________

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