Boost logo

Boost :

Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows) global variable
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-01-15 11:27:46


On 01/15/2015 02:11 PM, Beman Dawes wrote:

> * Suffix function argument names with "_". Rationale: Short and less
> distracting than "m_" prefix.

Projects I have worked on that use this guideline have suffered from
subtle errors anyways. As the name with and without the underscore
resemble each other too much, these errors tend to go unnoticed,
especially if the names are next to operators, e.g. "foo_->bar".

I personally avoid shadowing by selecting noticeably different names
(usually abbreviations or synonyms) for function arguments.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk