• 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: Turning off spurious C warning in XCode ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning off spurious C warning in XCode ?


  • Subject: Re: Turning off spurious C warning in XCode ?
  • From: Glen Low <email@hidden>
  • Date: Tue, 25 Nov 2003 07:41:30 +0800

http://developer.apple.com/documentation/Cocoa/Conceptual/
CodingGuidelines/index.html

If you look closely, you'll find that they say that instance variables
should *not* have '_' on the beginning because that notation is
reserved for use by Apple.


I don't understand why Apple recommends this. I find this naming convention
very convenient for accessor and mutator methods. Unlike with method names,
the compiler will warn you if you've overridden a variable with the same
name, so I don't see much harm in using underscores to prefix instance
variable names.

In the C++ Standard, and presumeably in the C Standard, double underscores anywhere in the identifier and single underscores (followed by a capital letter?) at the beginning of the identifier are reserved by the implementation. This was supposed to allow the implementation to define private stuff that wouldn't have a name clash with your stuff, which is especially true for C (and I would suppose Objective-C) where there are no namespaces.


Cheers, Glen Low


--- pixelglow software | simply brilliant stuff www.pixelglow.com _______________________________________________ xcode-users mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Turning off spurious C warning in XCode ? (From: Eric Wang <email@hidden>)

  • Prev by Date: Re: Syntax/Language mode
  • Next by Date: Re: Xcode incremental build problem
  • Previous by thread: Re: Turning off spurious C warning in XCode ?
  • Next by thread: Re: Turning off spurious C warning in XCode ?
  • Index(es):
    • Date
    • Thread