isascii (was: Another pitfall. Signed chars and ctype.h)

Henry Spencer henry at utzoo.uucp
Thu Mar 1 06:08:29 AEST 1990


In article <668 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>As much as *I* understand ANSI-C, all characters of the "machine
>character set" must have positive values. So IMHO problems with
>isdigit() and the other <ctype.h>-stuff can only occur,
>
>- if the compiler claims (only) to support ASCII,
>- but you in fact use it for non-ASCII (eg ISO 8859).

Sorry, not so.  The ANSI C restriction is weaker than that found in
earlier C documentation:  it says that the characters in the "source
character set" -- roughly speaking, the characters used to write C --
must be positive.  There is no promise made about other characters in
your machine's character set.

Various things in the standard encourage implementors to make char
unsigned, but it is not actually compulsory even if you have an 8-bit
character set.
-- 
"The N in NFS stands for Not, |     Henry Spencer at U of Toronto Zoology
or Need, or perhaps Nightmare"| uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list