
15 Jan
2015
15 Jan
'15
3:24 p.m.
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.