Here’s a fun warning message I saw today:


foo.h:408:15: warning: & has lower precedence than !=; != will be evaluated first [-Wparentheses]
  if( nibbles & 0x01 != 0 )
              ^~~~~~~~~~~
foo.h:408:15: note: place parentheses around the '!=' expression to silence this warning
  if( nibbles & 0x01 != 0 )
              ^
                (        )
foo.h:408:15: note: place parentheses around the & expression to evaluate it first
  if( nibbles & 0x01 != 0 )
              ^
      (             )

The author of the code appears to fluked out with this statement, since (0x01 != 0) == 1, which is exactly the bit that they were attempting to test against. Ironically, the != 0 was probably added for clarity, but if they had wanted to test against any other bit, the code wouldn’t have done what they expected, and “clarifying the statement” would have bugified it.