Joe Buck wrote:
On Mon, Jun 22, 2009 at 04:51:17PM -0700, Kaveh R. GHAZI wrote:
I also agree with Robert's comments that all warnings are about valid C,
with -Wall we diagnose what we subjectively feel is dubious coding
practice. Not everyone will agree with what -Wall contains, that's not a
reason to freeze it.
Right, but it's a cost-benefit tradeoff.
Now if someone does a test and shows that building the world exposes
hundreds or even dozens of these warnings, **and** none of them are actual
bugs, then I would reevaluate my opinion.
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 reseulting 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.