
| -----Original Message----- | From: boost-bounces@lists.boost.org | [mailto:boost-bounces@lists.boost.org] On Behalf Of Yuval Ronen | Sent: 29 June 2006 20:55 | To: boost@lists.boost.org | 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@hetp.u-net.com