underscore prefix

M

mike parr

A few times when looking at code on the net I have seen objects,
variables etc prefixed by an underscore. But I've never seen any
explanation for the reason for this. What is the reason for doing this?

Thanks,

Mike





*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
S

Scott Allen

I think the guidlines actually discourage use of m_ when it says "Do
not apply a prefix to field names or static field names."
 
B

Bob Grommes

Nothing magical about it; it's just one of many naming conventions for
private class members. I think the underscore prefix is favored by C++
coders.

--Bob
 
M

Mike

I think prefixing any variable in a strongly typed environment simply adds
clutter. I find the convention of capitalizing public members but not
private is much more elegant. Just my opinion.

Mike

Rakesh Rajan said:
Hmm...I have always been in the opinion that whenever we have an exposed
member like a public variable or property etc, we should avoid Hungarian
Notation and prefixes of any type. But for private entities, I would use m_
or a prefix...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top