Here is the official word - Programming with Objective C Encapsulating Data, and perhaps also the source of confusion
Most Properties Are Backed by Instance Variables
Unless you specify otherwise, the synthesized instance variable has the same name as the property, but with an underscore prefix. For a property called firstName, for example, the synthesized instance variable will be called _firstName.
Further down the same page (the part you quoted)...
You Can Customize Synthesized Instance Variable Names
Important: If you use
@synthesize
without specifying an instance variable name, like this:
@synthesize firstName;
the instance variable will bear the same name as the property.
In this example, the instance variable will also be calledfirstName
, without an underscore.
They do almost seem to contradict themselves, but the earlier paragraph is only referring to autosynthesized instance variables, while the latter is what happens when you explicitly synthesize.
Autosynthesis is a much newer feature which only came to XCode in version 4.4 with the inclusion of Clang compiler v4. Prior to this there were endless debates about the pros and cons of @synthesizing your variables with a leading undersore (legend had it that this was reserved for Apple's use), a trailing underscore (Google's objective-C style guide) or neither. Since XCode 4.4 this is settled: name all your iVars explicitly with a leading underscore, but better still leave the compiler do it for you.
update: I noticed Google has updated their style guide to fit in with the rest of us...
Trailing underscores were once preferred for instance variable names.
Our style guide used to have a rule saying that instance variables should be named with a trailing underscore, similar to the naming of member variables in C++. This was changed to leading underscores to be consistent with the broader Objective-C community, to better follow Apple's official guidelines, and to allow for use of new compiler features like automatic instance variable synthesis. New projects are strongly encouraged to use leading underscores. Existing projects may continue to use trailing underscores in new code to maintain consistency with the rest of their codebase.