signed vs unsigned pointer warning

Jamie Lokier jamie@shareable.org
Sat Oct 9 07:05:00 GMT 2004


Paul Jarc wrote:
> > No, (unsigned)-1 does not turn into 255, it turns into a very large
> > number.
> 
> But character 255, as a signed char, is also -1, and so will also
> become the same large number.  The caller must cast char to unsigned
> char to ensure that EOF is distinct.  *Only* the caller can make the
> distinction reliably, since only the caller knows whether this
> particular -1 is supposed to be EOF.

Is it necessary for them to be distinct?

I didn't see any rule in "man isalpha" saying anything about EOF
other than it's accepted as an argument value.

In particular, is it ok if isalpha(EOF) == isalpha(255), whatever the
value of isalpha(255)?

Or is there a rule that is*(EOF) must return 0?

-- Jamie



More information about the Gcc mailing list