• 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: the underscore naming convention
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the underscore naming convention


  • Subject: Re: the underscore naming convention
  • From: Todd Yandell <email@hidden>
  • Date: Sun, 28 Aug 2005 18:39:20 -0500


On Aug 28, 2005, at 8:58 AM, Jeff Childers wrote:

I have been looking at some palette examples the instances are defined prefixed with a underscore.
I read somewhere that apple uses this naming convention. Are the these developers just trying to write there code like apple or is there other reasons as well?

I generally use underscore prefixes for instance variables than aren't outlets, but I never use them for methods. You'll usually get warnings if you attempt to override instance variables that are definined in the superclass, but not for methods since it's perfectly legal to override them. Having an underscore helps me remember that it's an instance variable, and not, for example a variable that was passed in as a parameter, like so:


- (void)setBorderType:(int)borderType
{
    _borderType = borderType;
    [self setNeedsDisplay:YES];
}

Todd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >the underscore naming convention (From: Jeff Childers <email@hidden>)

  • Prev by Date: Re: Apple crash reports
  • Next by Date: NSCell -setFont Clobbers Editability?
  • Previous by thread: Re: the underscore naming convention
  • Next by thread: Is "foo" the password of user "baz"?
  • Index(es):
    • Date
    • Thread