I know it's a silly question but still: we're having a world war going here about whether or not to prefix private members with " _ " or " m_ ". group1 says "...it's the new microsoft suggestion for .net to camelCase your private menmbers and not put any /m prefix..". group2 (my group) says "...it's easier to see & understand that we're dealing with private members by using the /m prefix.." and also it's aligned with our old c++ code. i don't understand why change our coding style every time microsoft change their mind? what do you think? thanks, Adi Barda
See also http://stackoverflow.com/questions/111605/what-kind-of-prefix-do-you-use-for-member-variables
Some folks use _m
, others use just _
. If you wanted to you could use ThisIsAMember_
but that may be a bit verbose. Whatever you choose make sure everyone on the project uses it consistently.
I tend to shy away from all prefixes on private members but it really is a matter of personal taste.
It's up to you.
There are pros to each approach and you've listed them in your question.
You should go with the standards, sorry guidelines, that work for you and your team and as long as you can justify your decision there shouldn't be any problem. Having said that keeping a C++ standard is probably a bad idea.
Here we used to do that, but not any more. Instead we prefix all private members with _ and then camel case their names.
So we can have the private property _name
which is exposed through the public property Name
.