Linus Torvalds <[EMAIL PROTECTED]> writes: > 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.
Why strlen() should be allowed to be called with an incompatible pointer type? My point is that gcc should issue *different warning*, -- the same warning it issues here: $ cat incompat.c void foo(int *p); void boo(long *p) { foo(p); } $ gcc -W -Wall -c incompat.c incompat.c:2: warning: passing argument 1 of 'foo' from incompatible pointer type Calling strlen(char*) with "unsigned char*" argument does pass argument of incompatible pointer type due to the fact that in C "char" and "unsigned char" are two incompatible types, and it has nothing to do with signedness. [...] -- Sergei. - 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/