Re: [Boost-bugs] [Boost C++ Libraries] #9378: g++ 4.7 -Wshadow warnings need attention

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9378: g++ 4.7 -Wshadow warnings need attention
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-19 01:44:24


#9378: g++ 4.7 -Wshadow warnings need attention
------------------------------------------+--------------------------
  Reporter: Tom Browder <tom.browder@…> | Owner: eric_niebler
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: xpressive
   Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------------+--------------------------

Comment (by rmann@…):

 Clearly a difference in attitude. A similar bug I wrote against Eigen got
 a response today that they expect to be shadow-free in their next dot
 release.

 I'm only talking about shadowing, not every possible warning under the sun
 (although I believe it's generally best to avoid them). Obviously it
 should be fixed by someone who knows what they're doing, but in this case
 it should be mechanical (identifying errors, of course, is not. But fixing
 them such that the code remains equivalent is).

 Of course Boost can benefit. Right now, you have no idea if you are
 inadvertently referencing the wrong variable. If you once forget to
 properly scope the access to a shadowed variable, you've got a bug.
 Variables of different name make that more obvious. My personal approach
 is to modify the name of variables according to their scope (constant,
 global, static, member, parameter, method-local). Not only does this avoid
 shadowing (in almost every case you might want to use it; the compiler can
 catch the rest), it also makes it easy to identify where variables come
 from, without otherwise redundant use of "this".

 disable_warnings.hpp and enable_warnings.hpp is a pretty hacky fix.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9378#comment:10>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC