Extends.
I thought I was being cool when I did something like:
bool hasParent()
{
return this->parentNode ;
}
Even with a (bool) cast, the
Why is that a performance warning?
The compiler is turning this:
bool hasParent()
{
return this->parentNode;
}
into:
bool hasParent()
{
return this->parentNode != 0;
}
This takes about one clock cycle more than you might expect from looking at the code. It's an insignificant performance difference.
I think it's better to write out the != 0 explicitly anyway, as it makes the code clearer as well as silencing the warning.