[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: any g++ compilation warning to detect empty if statement
From: |
Bernd Strieder |
Subject: |
Re: any g++ compilation warning to detect empty if statement |
Date: |
Thu, 16 Aug 2007 15:50:12 +0200 |
User-agent: |
KNode/0.10.4 |
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