
On Thu, Jan 15, 2015 at 10:19 AM, Rob Stewart
* Prefix function argument names with "a_". Rationale: The "m_" prefix for member names has been a success.
Really? I think it's ugly.
Yes, that's why it is a success. It is ugly so users don't want to use it themselves, so it avoids the shadow warning issue.
* Suffix function argument names with "_". Rationale: Short and less distracting than "m_" prefix.
I use a _ suffix for data members and a _ prefix for formal parameters.
Yes, those are non-starters because users do follow such conventions.
Thoughts?
Despite that the warnings should probably be fixed, I don't think there is need for a naming policy.
Normally, I'd dismiss such warnings as unwanted noise, but given Beman's anecdotal evidence of the benefit of addressing them, I'm inclined to agree that they should be addressed.
It isn't just me; a quick search finds comments like "The clang -Wshadow warning is quite nice as code which trips it often has bugs due to accidentally referencing the wrong identically named variable" and a complaint Apple defaults to no shadow warnings. --Beman