Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-08-08 07:31:08


At 05:27 PM 8/7/2003, Bo Persson wrote:
>
>"Paul A. Bristow" <boost_at_[hidden]> wrote:
>
>>
>> (And other MS specific unhelpful warnings which could be dealt with
>by
>>
>> #ifdef _MSC_VER or BOOST_?
>> #pragma warning (disable : 4800) // inefficient bool conversion?
>> #endif
>>
>> As a general point, is there any reason why 'known to be unhelpful'
>> warnings like this cannot be disabled in Boost code?
>>
>
>A problem here is that the "inefficient bool conversion" often
>actually *is* an inefficient implicit conversion to bool. IME, most of
>these warnings can be removed by actually producing a bool value.
>Adding == 0 or != 0 is often all it takes.

FWIW, I've done that for years in my own code, and have come to believe
that it results in better code. It makes the intent clear to someone
reading the code. With an implicit conversion, a reader is unsure whether
or not the conversion was intended.

To answer Paul's question, some of the toolsets do disable "known to be
unhelpful" warnings. But I agree with Bo that this warning shouldn't be one
of them.

--Beman


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