delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/12/24/13:49:33

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 24 Dec 2004 13:48:44 -0500
Message-Id: <200412241848.iBOImiRM013524@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <KpSdnePxHo9G_VHcRVn-oQ@comcast.com> (message from Joe Wright on
Fri, 24 Dec 2004 13:33:07 -0500)
Subject: Re: CTYPE stuff for Eli or DJ
References: <KpSdnePxHo9G_VHcRVn-oQ AT comcast DOT com>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 'Splain me Batman. In ctypes.ha we have the macro..
> 
>     #define isspace(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISSPACE)
> 
> __dj_ctype_flags is an array 257 of unsigned short.
> 
> What assumptions are you making about '(int)(c)+1' that might ensure 
> the required index range of 0..256 ?

The ANSI C specification requires that applications pass only unsigned
chars, or the value EOF, to the ctype functions.  Values that meet
those requirements will not exceed the ctype array boundary.  Values
outside those requirements indicate that your application is faulty.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019