Is there some purpose for this convention?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Apple likes to use underscores to mean “private”, according to the Coding Guidelines for Cocoa:
Method names beginning with underscores are reserved according to The Objective-C Programming Language (which means they’re reserved even if you don’t use Cocoa, presumably):
Additionally, the C/C++ convention is that leading underscores are (often) reserved for the implementation. A lot of people misinterpret this and use _ for anything “private”; leading to the proliferation of _FooLog() calls in a large chunk of our codebase, even though it invokes undefined behaviour.
The only reason to do it is to discourage direct ivar access in your own class. Prevent ivar access from other classes with
@private.