[Bug c/66773] sign-compare warning for == and != are pretty useless
segher at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 22 14:54:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66773
--- Comment #16 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #13)
> > Yes. You should not use casts, except in some very specific cases, and
> > most of the uses you see "in the wild" are a bad idea. Sometimes I wonder
> > if we should have a -Wcast ("Warn for any cast.").
>
> I get the feeling that such a warning would be extremely noisy and that no
> one would use it.
It was not meant as a serious suggestion of course, or I would have done this
many many years ago.
My point is that *most* casts you see in the wild are a bad idea.
Unfortunately it isn't easy (if possible at all) to have the compiler give
the user good advice on this.
More information about the Gcc-bugs
mailing list