• 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
Objective-C Instance Variable Names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C Instance Variable Names


  • Subject: Objective-C Instance Variable Names
  • From: Richard Somers <email@hidden>
  • Date: Thu, 3 Apr 2008 10:29:41 -0600

There is a common practice of prefixing instance variable names with "_", a single underscore character.

If Objective-C 2.0 properties are used this would result in dots followed by underscores when invoking accessor methods with the dot syntax. Not a desirable situation.

It appears that Apple as of Mac OS 10.5 uses properties only in Core Animation classes and NSPointerFunctions.h with CALayer.h being the single biggest user. Nowhere when Apple uses properties does it also prefix instance variables with an underscore that I can find. Note that NSPointerFunctions.h contains some very interesting property examples.

It would appear then that the practice of practice of prefixing instance variable names with an underscore character is becoming a historical relic of the past.

Any comments?

Regards, Richard

_______________________________________________

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: Objective-C Instance Variable Names
      • From: Jens Alfke <email@hidden>
    • Re: Objective-C Instance Variable Names
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: More fun with C++
  • Next by Date: Re: Objective-C Instance Variable Names
  • Previous by thread: Seph K sent you a special gift
  • Next by thread: Re: Objective-C Instance Variable Names
  • Index(es):
    • Date
    • Thread