On 11.7.2008, at 04:59, William Xu wrote:

Jens Alfke <[EMAIL PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/kai%40granus.net

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to