Re: Patch for isdigit/isalpha/etc. macro arguments

DJ Delorie
2007-04-09T12:57:28Z

Andreas Schwab <schwab@suse.de> writes:
> How can it distinguish EOF from '\377'?

EOF is -1 and '\377' is 255; they're different values. Functions that
may return EOF return an int, not a char, and you should not cast that
value to char before checking for EOF.

The is*() macros take an int because there are 257 different values
(-1..255) that they must accept, not 256.

In many cases, programmers use 'char' to hold the result of, for
example, fgetc(), and the warning from gcc is valid (although
indirect) because they've lost the EOF marker.