isascii (was: Another pitfall. Signed chars and ctype.h)
Karl Heuer
karl at haddock.ima.isc.com
Fri Feb 16 09:40:34 AEST 1990
In article <2448 at ditsyda.oz> evans at ditsyda.oz (Bruce Evans) writes:
>Why doesn't ANSI C guarantee isdigit() (etc.) on *all* characters?
(The above seems to mean, "both signed and unsigned characters".)
Assume a character set in which (char)-1 is printable, e.g. ISO Latin 1. Your
proposal would require that isprint((int)(signed char)(-1)) test as true. But
isprint(EOF) is required to test false. Thus, this would require that EOF be
defined as a value other than -1. This is permitted by the Standard (I'm not
entirely sure why), but it would be A Bad Thing to create conditions that
*require* it.
Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint
More information about the Comp.lang.c
mailing list