Re: [ofa-general] Re: dealing with gcc 'comparison is always false' warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 > However, gcc is _just as correct_. It is only crying about seeing a condition
 > that the programmer could have written with some purpose in mind but which
 > is being completely compiled away by it when generating the code because
 > of it being a tautology / contradiction ...

Well, OK, but there's lots of things gcc could warn about.  How about

	while (1) { ...

By your argument gcc should warn that '1' always evaluates to true.
Or how about

#if 0

why shouldn't the preprocessor warn that the conditional is always false?

 > No, shutting gcc up wouldn't be the right thing, IMHO. These warnings are
 > a good reminder to the programmer to go and see if there is a real bug
 > somewhere and if something really needs to be done with the code (could
 > be simply to change the type of a variable to signed that was mistakenly
 > declared unsigned, f.e.).

OK, but suppose I looked at it and there's no bug.  Leaving the
warning has a cost too: it hides useful warnings (that might be
showing real bugs) in all the clutter.

 - R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux