signed vs unsigned pointer warning

Morten Welinder terra@gnome.org
Wed Sep 22 17:27:00 GMT 2004


> EOF isn't a character.

No-one said it was.  It evaluates to an int.

> I don't understand your point.  isprint takes a char * argument.

NO!

It takes an int argument.  And only certain ints are valid: EOF
(== -1 everywhere, it seems) and the range of unsigned char, i.e.,
0-255.  If you wanted to make signed args valid arguments -- and
doing so would be an extension to the standards -- then isprint
would need to be able to distinguish EOF and (int)(signed char)-1.
How do you propose to do that?

> You can do it by casts, by configure, or by using a 384 entry
> array, to mention just a few.

As it follows from the above, neither of these methods actually
work.

Morten



More information about the Gcc mailing list