------- Comment #7 from pinskia at gcc dot gnu dot org 2006-09-25 19:29 ------- (In reply to comment #6) > After consulting the oracle (In the this case ANSI X3.159-1989,) and being > unable to find any information to support the claim that char is always > different type than unsigned char or signed char, I'd like to have this bug > reopened, at least as amended by my comments below.
> 3.5.4.1 (Pointer Declarators) and 3.3.3.2 (Address and Indirection Operators) > the sections that deal with pointers make no mention, and 3.1.2.5 definitely > says that whether char is signed or not is implementation defined. C++ in a way is clearer here that char, signed char, and unsigned char are three distant types but C90 and C99 do say that but is not clear about it. > However, it seems to me, the discussion of what type char is is missing the > one > point of the original bug. The original bug points out that when the default > type of char is set to one of signed or unsigned, the compiler does not treat > pointers to char as if they have the same signedness as char. I'd like to at > least see that much fixed, so that if -funsigned-char is used, then references > through pointers are treated to the same warnings as direct references. -funsigned-char just changes the default semantics of char and not the actual type. > By the way, there is no 6.2 in the the C '89 spec, as far as I can tell. > Which > spec were you referencing? C99. > Aside: char serves two distinct roles in C. While it is the character type, it > is _also_ the smallest integer type. It is the only 8 bit integer type on most > processors, and so serves the purpose of 8 bit integer arithmetic. This turns > out to be important in cryptographic applications, among other things. Again, this was orginally done this way because of K&R C. It is also a special integer type which means char, signed char and unsigned char three distant types. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28912