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 To: djgpp AT delorie DOT com In-reply-to: (message from Joe Wright on Fri, 24 Dec 2004 13:33:07 -0500) Subject: Re: CTYPE stuff for Eli or DJ References: Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > '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.