[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts tha
From: |
Douglas Dotson |
Subject: |
Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing |
Date: |
Mon, 13 Dec 2004 16:07:02 -0800 (PST) |
Absolutely! One should not rely on the compiler
as a substitute for good practices. Most of the
compilers that I have used that attempt to warn
about every potential pitfall, output so much static
that real problems get lost in the noise. This is
especially true in C since it is so flexible.
Doug
--- address@hidden wrote:
> Date: Mon, 13 Dec 2004 15:34:16 -0800 (PST)
> From: Douglas Dotson <address@hidden>
> Subject: RE: [avr-gcc-list] Feature request -
> compiler warning for "if" stmts
> that do nothing
> To: Dave Hylands <address@hidden>,
> Joerg Wunsch
> <address@hidden>,
> address@hidden
>
> ...
> Best solution is to develop good programming
> skills that avoid the
> typical pitfalls.
>
>
> And also good style; I hate it when I see an empty
> loop done as
>
> while (*a++ = *b++);
>
> It makes it so much more obvious you meant it to be
> empty when you
> instead do
>
> while (*a++ = *b++)
> ;
>
> Or even better
>
> while (*a++ = *b++)
> ; /* empty */
>