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 02:44:08
#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 steven_watanabe):
Replying to [comment:10 rmann@â¦]:
> 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).
>
Mechanically rewriting the code like this has no benefit
to anyone.
Either
a. It's immediately obvious where each variable comes from, or
b. It isn't obvious what a name refers to.
If (a) is true, then rewriting the code will not make
the code more understandable and in fact using mangled
names can make it harder to follow. Otherwise, the
more (b) is true, the more likely it is that these
mechanical changes will accidentally change the behavior.
Besides which, if all you want to do is tell the compiler
to shut up, the safest and most reliable solution is to
do exactly that, i.e., #pragma GCC warning ignored -Wshadow.
> Of course Boost can benefit. Right now, you have no idea if you are
inadvertently referencing the wrong variable.
I beg to differ. I'm not.
> disable_warnings.hpp and enable_warnings.hpp is a pretty hacky fix.
I don't see why. It means that library code can be compiled with the
warning settings that the library author considers useful, rather
than whatever each user wants. Suppressing warnings is often necessary
anyway (e.g. C4512: Assignment operator could not be generated.) and
these headers are a lot more convenient than writing #ifdefs everywhere.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9378#comment:11> 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