Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2008-04-02 04:44:14


John Femiani wrote:
> Roland Schwartz wrote:
>>
>> I have seen some attempts from library authors,
>> e.g. boost/thread/win32/conditiona_variable.hpp
>> to get rid of the annoying MSVC warnings.
>>
>> However this seems not to work (at least on my machine).
>>
>
> How does the pragma work? Does it disable all warnings, or only
> warnings
> in subsequent declarations? Does the warning state apply when a
> template class is declared or instantiated?

Only subsequent declarations: and by using #pragma warning(push/pop) you can
scope the warning disabling to a specific section of code, while leaving the
warning turned on for everyone else (if they want it).

> John Maddock wrote:
>> Anthony Williams wrote:
>>>> Couldn't this issue be handled by the boost config headers?
>>>
>>> That would seem better than handling it on a case-by-case basis, but
>>> it might change things for user code too (i.e. any code included
>>> *after* the boost headers).
>>
> In VC8, there is #pragma push_macro and pop_macro
>
>> It's also fragile: it only works if the Boost header is the first
> header
>> included, and if that header doesn't include any std lib headers
> before
>> boost/config.hpp :-(
>>
>
> But what if there is other truly deprecated code? Isn't disabling the
> macro much more specific than disabling all warnings for all
> deprecated
> code?

No the macros are a global setting - the only reliable way to set these is
globally on the command line, you can't turn them on and off for specific
sections of code.

HTH, John.


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