Another pitfall. Signed chars and ctype.h.

Henry Spencer henry at utzoo.uucp
Sun Feb 11 10:16:24 AEST 1990


In article <11957 at frog.UUCP> john at frog.UUCP (John Woods) writes:
>You have to say
>
>	isascii(*s) && isdigit(*s)
>
>isdigit() and friends are all only defined on those values for which
>isascii() is true...

This is the K&R1 situation.  Unfortunately, the ANSI C situation is as
Felix represented it:  isdigit() is required to work on all unsigned chars
plus EOF.  Trying to build code that will work in both of these environments
is a real headache.
-- 
SVR4:  every feature you ever |     Henry Spencer at U of Toronto Zoology
wanted, and plenty you didn't.| uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list