Re: somebody dropped a (warning) bomb

Linus Torvalds
2007-02-09T15:58:21Z

On Fri, 9 Feb 2007, Sergei Organov wrote:
>
> As far as I can read the C99 standard, the "char", "signed char", and
> "unsigned char", are all different types:

Indeed. Search for "pseudo-unsigned", and you'll see more. There are
actually cases where "char" can act differently from _both_ "unsigned
char" and "signed char".

> If so, then the code above is broken no matter what representation of
> "char" is chosen for given arch, as strcmp() takes "char*" arguments,
> that are not compatible with either "signed char*" or "unsigned char*".

..and my argument is that a warning which doesn't allow you to call
"strlen()" on a "unsigned char" array without triggering is a bogus
warning, and must be removed.

Which is all I've ever said from the beginning.

I've never disputed that "char" and "unsigned char" are different types.
They *clearly* are different types.

But that doesn't make the warning valid. There is a real need for NOT
warning about sign differences.

But this argument has apparently again broken down and become a "language
lawyer" argument instead of being about what a reasonable compiler
actually can and should do.

As long as gcc warns about idiotic things, the kernel will keep shutting
that warning off. I'd _like_ to use the warning, but if the gcc
implementation is on crack, we clearly cannot.

There's simply an issue of "quality of implementation". In the case of
this warning, gcc is just not very high quality.

Linus