Re: Any good advice for naming parameters of init methods?
Re: Any good advice for naming parameters of init methods?
- Subject: Re: Any good advice for naming parameters of init methods?
- From: Kai <email@hidden>
- Date: Fri, 11 Jul 2008 16:29:59 +0200
On 11.7.2008, at 04:59, William Xu wrote:
Jens Alfke <email@hidden> writes:
With any naming convention, the possible problem is a conflict with
a name in a
superclass. Apple's Cocoa frameworks tend to use a "_" prefix for
both ivars
and private method names.
How about using "_" as postfix then? Like `this_one_'. I find google
c++ guide suggests that:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Variable_Names
Looks good to me.
The only disadvantage of this approach is that KVC’s direct access to
your ivars_ will no longer work. KVC knows about the _ivar convention
(because it is used by Apple ;-) ) and matches an _ivar to the key
"ivar". It won’t for ivar_. But than again it is better anyway to have
explicit accessors, I’d say.
Kai
PS and OT: _ivar is not (any more) considered portable C++ either
because all names beginning with _ are reserved for compiler/library
use by the standard.
--
William
http://williamxu.net9.org
... I think I'd better go back to my DESK and toy with a few common
MISAPPREHENSIONS ...
_______________________________________________
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
_______________________________________________
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