
On Thu, Jan 15, 2015 at 10:24 AM, Peter Dimov
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.
Agreed. I'm hoping that we can figure some decoration. I've used "name_arg" / "reason_arg" style once in a while, although that is a bit long-winded. --Beman