Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost 1.54.0 Header Warnings: Shadowed Variables
From: Tom Browder (tom.browder_at_[hidden])
Date: 2013-11-13 17:23:05


On Wed, Nov 13, 2013 at 2:30 PM, Eric Prud'hommeaux <eric_at_[hidden]> wrote:
> On Nov 13, 2013 8:40 PM, "Chris Glover" <c.d.glover_at_[hidden]> wrote:
>> In my opinion this is an over-simplification. Many warnings raise false

Probably, but I believe at least some of the warnings are valid, and
some of the affected library authors agree that at least some of the
warnings are validly confusing.

At any rate, I will submit patches for the developers who have been
amenable to my plight.

In the meantime, I have belatedly discovered that gcc 4.7 pragma
diagnostic works for -Wshadow. We now envelop our source code
include lines for the offending Boost headers as shown in the
following example:

#if defined(__GNUC__)
/* for g++ to quell -Wshadow warnings */
#pragma GCC diagnostic ignored "-Wshadow"
/* ...include lines with Boostheaders with -Wshadow warnings... */
#pragma GCC diagnostic pop /* end ignoring -Wshadow */
#endif /* __GNUC__ */

Thanks, all, for the friendly discussion.

Best regards,

-Tom

>> alarms in perfectly legitimate code and in my professional experience,
>> jumping through the 'warning free' hoops to clean that up leads to
>> obfuscated code as you make things more complicated just to silence
>> warnings.
>>
>> This is not a good thing.
>>
>> So, though I don't think the code should be changed to fix this, it could
>> be argued that the warning should be silenced in the header so as to not
>> pollute your warning stream.
>
> That would meet the use case of the programmer writing portable code and
> counting on -Wshadow. While he/she could put in a zillion pragmas around the
> includes, maintaining those pragmas makes using the library less attractive.
> I quit using a library for exactly this reason.
>
>> -- chris
>
>
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net