Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!bu.edu!bu-cs!lectroid!jjmhome!cpoint!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.c Subject: Re: Another pitfall. Signed chars and ctype.h. Message-ID: <11957@frog.UUCP> Date: 9 Feb 90 05:59:00 GMT References: Organization: Misanthropes-R-Us Lines: 18 In article , flee@shire.cs.psu.edu (Felix Lee) writes: > If you have "char * s;" you cannot say something like "isdigit(*s)" if > you want to be 8-bit clean. "isdigit" etc. take an (int) in the range > [-1, UCHAR_MAX]. > You have to say "isdigit((unsigned char) *s)". You have ahold of the wrong end of the stick. You have to say isascii(*s) && isdigit(*s) isdigit() and friends are all only defined on those values for which isascii() is true. If your vendor declares that isascii((char)0x85) is true, then isdigit((char)0x85) better be made to work, one way or another. -- John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101 ...!decvax!frog!john, john@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu