Subject: Re: [boost] Official warnings policy?
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-11-04 14:22:24
Zachary Turner wrote:
> That aside, should we consider how to deal with #pragma
> warning(disable) in MSVC (do other compilers have similar pragmas)?
> Should it be disallowed? Otherwise it's all too easy for a library
> maintainer who doesn't want to
> fix a certain warning to just stick a pragma in there to disable it.
EDG frontends supports a similar system for pragmas that disable warnings, so that covers several compilers.
If only it were true that pragmas were easy to use to disable warnings in templates. Library users don't tolerate #pragma waring disable in header files that change the warning policy for their own code. That means you have to restore the warning setting with #pragma warning default. However, for templates the warning policy observed is often that of the line in which the template is instantiated and not where it is defined. That means you have to tightly wrap the line of code that produces the warning within the template definition with pragma disable and pragma default. If the line that produces the warning is a function or class declaration then you sometimes cannot disable the warning with pragmas at the point where the declaration is made. There are several effective C++ warnings in particular that cannot be suppressed in template code without disabling them globally.
Fixing warnings tends to be as easier than pragma disabling them most of the time.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk