Re: the underscore naming convention
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