|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-06-30 05:43:17
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]] On Behalf Of Yuval Ronen
| Sent: 29 June 2006 20:55
| To: boost_at_[hidden]
| Subject: Re: [boost] Supressing warnings
|
| Paul A Bristow wrote:
| > IMO Boost-worthy code should be able to be compiled in
| strict mode, for MSVC
| > level 4, without producing a blizzard of warnings.
| >
| > Including a list of warnings that the authors of the
| library consider
| > unhelpful, and in some cases, unfixable (specifically the warning
| > "conditional expression is constant. ")
| >
| > by using, for example
| >
| > #ifdef _MSC_VER
| > # pragma warning(disable: 4127) // conditional expression
| is constant.
| > #endif
|
| This warning is not so bad, IMO. It tells you that you are trying
| evaluate a compile-time constant in run-time, and that's wasting CPU
| cycles. The runtime 'if' can be substituted by a compile-time
| specialization.
<snip>
If I now write (a VERY common example)
if(std::numeric_limits<T>::has_infinity)
return std::numeric_limits<T>::infinity();
It IS I believe a C++ language fault, that has_infinity doesn't work like a
macro constant,
described by Bjarne Stroustrup as "an embarassment",
(a TODO for C++0X but reference to which escapes me at present).
What in this type of case are you suggesting that I write for the time
being?
And since it is VERY common, it had better be short ;-) MACROs just about
allowed!
Thanks
Paul
PS If I write
if(true) ...
I'm not sure why I need a warning about it :-)
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk