Thank you, David, that's pretty clear.

Sounds like safety first for my code: always use the setter/getter for 
synthesized properties, even in self.

Or use @private ivars.

ScottB

On Oct 12, 2011, at 09:46 , David Duncan wrote:

> On Oct 12, 2011, at 9:21 AM, Bayes Scott F wrote:
> 
>> Someone on Matt's site mentioned the possibility that the synthesized ivar 
>> could be implemented indirectly, say as a member of a collection. Since the 
>> implementation's opaque, we don't know if that ever can happen.
> 
> I can't say that I know what could be done, thats something the compiler guys 
> would have to figure out :).
> 
>> And does the compiler ever shortcut something like self.mySynthSimpleIntVar 
>> to self->mySynthSimpleIntVar, or does it always use the setter/getter?
> 
> 
> Due to the nature of C and Obj-C, the compiler can never safely short circuit 
> the message send. From C's point of view this is due to the compiler seeing 
> an opaque implementation of objc_msgSend*() where you see the accessor, as 
> such the C compiler cannot inline the function. From an Obj-C point of view, 
> the primary issue is that the compiler doesn't actually know for certain that 
> other code in your application or the frameworks it links against haven't 
> changed the implementation of your accessor and thus require it to be called 
> for correct operation.
> --
> David Duncan
> 

_______________________________________________

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