Hello,

eric wrote:

> recently encounter following bugs:
> 
> if (a > b);        //<- bug in the careless ";" here
>    return 0;
> 
> Due to the extra ";" in the if statement line, it always return 0.
> 
> Anyone know g++ has any compiler - warning flag to detect this kind of
> error? if not, is it any source code checking tools can do it ?

It is in the docs of gcc-4.1.2 under -Wextra, but it seems to not work
in gcc-4.1.1 or the prerelease of 4.1.2 I have. I can provoke the
warning using gcc-4.2.1.

Bernd Strieder

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to