floating point - Is if(double) valid C++? -
i ran line of code:
if( linedirection.length2() ){...}
where length2
returns double
. kind of puzzles me 0.0 equivalent 0, null
, and/or false
.
is part of c++ standard or undefined behaviour?
it standard behavior (boolean conversion)
$4.12/1 - "an rvalue of arithmetic, enumeration, pointer, or pointer member type can converted rvalue of type bool. 0 value, null pointer value, or null member pointer value converted false; other value converted true."
Comments
Post a Comment