Boost logo

Boost :

Subject: Re: [boost] suggestion on assertion macros
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-12 15:10:54


AMDG

Roland Bock wrote:
> Stewart, Robert wrote:
>> C4800 seems ridiculous. Writing code using int as a Boolean is
>> common to C code. Why would VC 9 inflict useless noise when compiling
>> such code? Besides, if the variable is int, and it is needed in a
>> Boolean context, what else would the developer do? I've seen use of
>> the conditional operator to avoid that warning. I suspect that
>> produces worse code than what is done when "forcing value to bool
>> 'true' or 'false'."
>>
> I agree. Still, I hope that static_cast is allowed to remove C4800

Nope.

.\scratch.cpp(20) : warning C4800: 'int' : forcing value to bool 'true'
or 'false' (performance warning)

In Christ,
Steven Watanabe


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