Question

AnalysisTool (a Clang GUI front end) states some fo my ivars are improperly named:

Specifically:

the name of instance variable 'groupName' doesn't start with the 'm' prefix

What does the 'm' prefix stand for in Cocoa?

Should I be using it? Or is this a false positive.

Was it helpful?

Solution

It's quite common for developers to give the instance variables of their objects names beginning with m_ (short for "member"), and the rule you're seeing shows that your code doesn't conform to that convention. If you don't want to follow this convention in your code, just turn that rule off in the analyser.

OTHER TIPS

AnalysisTool is a front end GUI, but also uses some custom rules that are not part of Clang. To my knowledge, Clang doesn't enforce/suggest any naming conventions for instance variables, so what you're seeing is probably an in-house coding style (used by the developers of AT) that you can safely ignore. See this SO answer for more details.

The Clang Static Analyzer itself is now available as a binary download for Leopard, whereas previously you had to build it yourself, which was complex and time-consuming. It's fairly easy to use without a GUI, and the reports are pretty nice overall.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top