Comment by Panzerschrek
10 hours ago
With such example:
bool Complement( bool x )
{
return ~x;
}
GCC gives a warning if compiling with -Wall:
test.cpp:3:10: warning: ‘~’ on an expression of type bool [-Wbool-operation]
return ~x;
So, it's surprise that C++ does this, but ones who enable compiler warnings are not in trouble.
No comments yet
Contribute on Hacker News ↗