I'm sometimes doing the obvious mistake of adding a ";" after an
if-statement.
if (<expression>); DoSomething();
This error sometimes causes weird behaviour of the program, and are
hard to spot in the code.
I once read a recommendation that you should always add curly braces,
even if for single statement blocks:
if (<expression>); { DoSomething(); }
...as this would normally cause a good compiler to issue a warning.
But, using XCode on Mac (built on top of GCC) I'm not warned for
these errors, and I can't find an option in Xcode to enable such a
warning.
Is there another way to make gcc issue a warning for empty statements
such as the one above (I know it's legal C / C++ code, but it's use
is fairly narrow I would say).