Boost logo

Boost :

Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows) global variable
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2015-01-15 12:58:47


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Beman Dawes
> Sent: 15 January 2015 17:00
> To: Boost Developers List
> Subject: Re: [boost] Warning policy? local variable hides (i.e. shadows)
global
> variable
>
> > But in this case the warning is spurious since the library code uses
> > its parameters in either case.
>
> That's an interesting point. The user can suppress the warning from
> VC++ by wrapping the header include:
>
> #pragma warning (push)
> #pragma warning (disable : 4459)
> #include <boost/lexical_cast.hpp>
> #pragma warning (pop)
>
> I suppose GCC has similar pragmas and other compilers support either the MSVC
or
> GCC pragmas.
>
> The header itself could provide the pragma's when appropriate (i.e.
> the library itself not under test).

We have a document that gives some help on supressing warnings.

https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines

If the warnings are determined by the author to be spurious,
then I see reason why using the various mechanisms to suppress the warnings
should not be used.

Suppressing the warnings documents that the issue has received rational thought
and that the warning would be misleading (and often very annoying leading to
pages of what is just clutter).

(Sadly some platforms have less good mechanisms, but ...)

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk