logoalt Hacker News

Panzerschrek • today at 1:46 PM • 0 replies • view on HN

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.