Expands .
I thought I was cool when I did something like:
bool hasParent ()
{
return this-> parentNode;
}
Even when using (bool), the warning still does not disappear.
If this-> parentNode is NULL if there is no parent node.
But I get:
warning C4800: 'Node *': forcing value to bool 'true' or 'false' (performance warning)
What a deal, yo? Why is this a performance warning? I thought it would be more efficient not to write something like:
bool hasParent ()
{
if (this-> parentNode)
return true;
else
return false;
}
But the second version does not generate any warnings, and the compiler seems much happier. Which is faster though?
c ++ performance casting
bobobobo Dec 04 '09 at 15:54 2009-12-04 15:54
source share