• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Synthesized instance variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Synthesized instance variables


  • Subject: Re: Synthesized instance variables
  • From: Frank Illenberger <email@hidden>
  • Date: Thu, 12 Mar 2009 17:54:07 +0100

And what prevent you to simply declare the ivar in the interface
instead of letting the compiler generating it ?

I second Andreas. For most cases, the correct place to declare instance variables should be the .m file as they are an implementation detail and not part of the contract with the outside world using the class. The feature of non-fragile instance variables of the modern ABI should make this dream possible. Synthesizing already takes place on the .m side but I also do not know how to gain access to the actual synthesized instance variable in a custom getter. Using objc_getInstanceVariable is not a good alternative as it is far to slow for being used in an on-demand getter. I think, Andreas does not care whether it is theoretically possible for the outside world to access the memory of his instance variables. He merely does not want to cite them is the contract.
The Objective-C release notes mention the symbol format OBJC_IVAR_ $_ClassName.IvarName for ivars but the compiler does not seem to understand it.
Does anybody know a way to access synthesized instance variables without using the synthesized getter methods?
And why isn't there a way to explicitly declare instance variables in the .m file for the new runtime?


Cheers

Frank

_______________________________________________

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


  • Follow-Ups:
    • Re: Synthesized instance variables
      • From: Greg Parker <email@hidden>
    • Re: Synthesized instance variables
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: A minimal InputManager bundle
  • Next by Date: Re: code for drawing an NSTextField to a panel window ...
  • Previous by thread: Re: Synthesized instance variables
  • Next by thread: Re: Synthesized instance variables
  • Index(es):
    • Date
    • Thread