On 22/08/2008, at 12:59 PM, Thomas Engelmeier wrote:

Am 22.08.2008 um 00:59 schrieb Dave MacLachlan:

Also, are the _ in front of member variables for Apple only (so we don't stomp on each other with member var names) or are they using them for the readability reason mentioned above? There is documentation where they have claimed _ at the beginning of method names as being Apple only, but nothing about method vars, and the KVC compliance docs seem to imply that it is fine to do.

Officially it is Apple only, but everybody and his dog uses it - in consistency to quite some Apple-provided samples. Also, in C++ the _ variable prefix is reserved for stdlib- implementation. The reasoning why many people do not consider it as problematic if there is a collision with an Apple defined _ prefixed ivar is you will see an compiler error once there is a collision.

Which pretty much means the preceding _ is just noise and gibberish and therefore plain bad style – something to avoid, it's not clever programming. Good style is to choose plain-language identifiers. The use of _ is to put white space between words in long identifiers, in contrast to poorly readable camelCase (maybe that should be hunchback case). (And note the spaces are outside the parentheses, not inside.) Why is it programmers generally choose the less-good way to do things, like programming Windows and C++!!

For methods OTOH, you don't get an warning but potential runtime crashes and undefined behavior.
_______________________________________________

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