some unusual errors

DJ Delorie
Tue Sep 22 19:41:00 GMT 1998

J. J. Farrell wrote:
> isspace() is prototyped as isspace(int); if the caller
> were using the function version, then the prototype would
> be effective, and the char would have been silently and
> correctly widened to an int.

No, the char would have been silently and INcorrectly
widened to a *signed* int, resulting in a range of values of
-128..127.  That is not the legal range of values for the
is*() functions.

The legal range of values for is*() is 0..255 and EOF.  The
automatic widening of a [default signed] char results in
signed int values in the range -128..127.  You cannot rely
on the automatic widening to give correct results.

On a side note, using a signed char as the input makes it
impossible to tell the difference between character 255 and
the traditional EOF value of -1, as both have the same bit
pattern (0xff) when stored in a signed char variable.

Because there are 257 legal parameter values for is*(), an
8-bit variable is simply too small to represent them without
loss or inaccuracy.
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list