|
Boost : |
Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows) globalvariable
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-15 10:24:56
Beman Dawes wrote:
> Should Boost have policy to clear these warnings?
I found one place where -Wshadow was quite annoying.
class error
{
private:
std::string name_, reason_;
public:
error( std::string const & name, std::string const & reason ):
name_( name ), reason_( reason ) {}
std::string name() const { return name_; }
std::string reason() const { return reason_; }
}
The name() member function is shadowed by the constructor parameter. I can't
use name_ for the parameter because of the member. I don't want to use _name
for the parameter because the leading underscore is legal but for obscure
reasons. So I was forced to use abbreviations like nm and rsn, which isn't
very readable.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk