Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2007-02-14 05:36:07


>From Matthias Schabel
> From Paul?? (attribution snipped):
>> may I suggest that none of these are helpful warnings and should be
>> suppressed:
>>
>> After the boost includes (to make sure BOOST_MSVC is defined).
>>
>> #if defined (BOOST_MSVC)
>> # pragma warning(push)
>> # pragma warning(disable: 4127) // conditional expression is
constant
>> # pragma warning(disable: 4100) // unreferenced formalparameter
>> // or comment out the parameter thus /* unused_one
*/
>> # pragma warning(disable: 4512) // assignment operator could not be
generated
>> #endif
>>
>> rest of code ....
>>
>>
>> #ifdef BOOST_MSVC
>> # pragma warning(pop)
>> #endif
>>
>> #endif // BOOST_UNITS
>
> Thanks for the tip. I'm a little uneasy committing this to the
> library itself; I sort of feel that deciding what level of
> warning you want is up to the user of the library.

I think you may have missed what the change does. It suppress the
warnings FOR THE LIBRARY CODE. The warning state is left unchanged for
the user's code.

That's what "# pragma warning(pop)" does.

Obviously, unilaterally suppressing warnings in the user's code is rude.
However, leaving ANY warnings showing from library code is also rude -
the user is entitled to expect that the library "just works", and any
warnings from library code will hide her own warnings.

> Naturally, I could be convinced otherwise...

Does the above help?

(Incidentally, personally I would not disable 4100. I would comment out
the paramenter name instead. The only exception is if the parameter is
used on other platforms (via #if) but not on MSVC).

-- 
Martin Bonner
Project Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com

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