The following program is valid C and valid C++. In either language, it probably doesn't do what the programmer thought it did. bool f(); void g(); void h() { if (f()) g(); }
Compiling this as C, we can get a warning about this: [tmp]$ gcc -c -Wall -W foo.c foo.c: In function 'h': foo.c:5: warning: empty body in an if-statement Compiling as C++, we get no such warning. Why? This mistake is just as bad in C++ as in C. -- Summary: warning for misplace semicolon is C-only Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: austern at apple dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19773