4 ms·
> Don't start variables with o_, obj_, m_ etc. A variable does not need tags which states it is a variable. I disagree on this one -- it's helpful to be able t
by bostonpete 15y ago
> Don't start variables with o_, obj_, m_ etc. A variable does not need tags which states it is a variable.
I disagree on this one -- it's helpful to be able to quickly recognize whether a given variable in a method is a local variable or a member variable of the class.
- greggman 15y agoI agree with you 100%. I also agree Joel Splosky with the goal of making wrong code look wrong which is why I hate my company's style guide. For C++ they name member variables with _ as in name_, address_, The problem I have with that is in a complicated expression it's easy to mistake one for the other. with m_ or some other more obvious prefix that wouldn't happen.
- RandallBrown 15y agoTagging your variables isn't really needed anymore thanks to syntax highlighting in modern text editors. I'm pretty on the fence about it actually. It's not really necessary because of syntax highlighting, but it is convenient to just type m_ and get a list of all the member variables from intellisense.
- to3m 15y agoWhich modern text editors do this?
- el_presidente 15y agoFrom http://mindprod.com/jgloss/unmainnaming.html http://mindprod.com/jgloss/unmainnaming.html a naming convention from the world of C++ is the use of "m_" in front of members. This is supposed to help you tell them apart from methods, so long as you forget that "method" also starts with the letter "m".