Extends.
I thought I was being cool when I did something like:
bool hasParent()
{
return this->parentNode ;
}
Even with a (bool) cast, the
The compiler needs to generate additional code for converting a pointer to bool. It is basically a comparision against zero and setting the result to one if not zero.
00000000004005e0 <_Z4testPv>:
bool test(void* adr) {
4005e0: 48 85 ff test %rdi,%rdi
4005e3: 0f 95 c0 setne %al
return adr;
}
4005f8: c3 retq
This isn't directly visible from the source, so the compiler thinks this is something the user should be warned about.