On Tue, Jun 23, 2009 at 12:43 AM, Alan Modra<amo...@bigpond.net.au> wrote: > On Mon, Jun 22, 2009 at 09:45:52PM -0400, Robert Dewar wrote: >> Joe Buck wrote: >>> I think that this should be the standard: a warning belongs in -Wall if >>> it tends to expose bugs. If it doesn't, then it's just somebody's idea >>> of proper coding style but with no evidence in support of its correctness. >>> >>> A -Wall warning should expose bugs, and should be easy to silence in >>> correct code. >> >> To understand what you are saying, we need to know what bug means, since >> it can have two meanings: >> >> 1. An actual error, that could show up right now in certain circumstances >> >> 2. An error resulting in undefined behavior in the standard, but >> for the current version of gcc, it cannot actually cause any real >> misbehavior, but some future version of gcc might take advantage >> of this error status and do something weird. >> >> For me it is enough if warnings expose case 2 situations, even if >> they find few if any case 1 situations. > > I agree, but I think this warning should be in -Wc++-compat, not -Wall > or even -Wextra. Why? I'd argue the warning is useless for C code, > unless you care about C++ style.
I do not think it is useless for C99 codes because C99 allows C++ style declarations/initialization in the middle of a block. -- Gaby