signed vs unsigned pointer warning
Paul Jarc
prj@po.cwru.edu
Fri Oct 8 19:57:00 GMT 2004
Joe Buck <Joe.Buck@synopsys.COM> 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.
paul
More information about the Gcc
mailing list