X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f NNTP-Posting-Date: Fri, 24 Dec 2004 13:00:45 -0600 Date: Fri, 24 Dec 2004 14:00:53 -0500 From: Joe Wright User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: CTYPE stuff for Eli or DJ References: <200412241848 DOT iBOImiRM013524 AT envy DOT delorie DOT com> In-Reply-To: <200412241848.iBOImiRM013524@envy.delorie.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 22 NNTP-Posting-Host: 69.143.13.12 X-Trace: sv3-Isz72ucjVse95jIWaonoEPIfMyiI/2XA9obbG66qpxGjUGp4dLLc6OAYam0imlf7H4aM6eVmLpYSf7g!vNkf1Y0KnhdfCd2OCPZgeNGJxqZ6VWjk7e3A2Oa5TifVaGWoPdOYzkAKKAM7 X-Complaints-To: abuse AT comcast DOT net X-DMCA-Complaints-To: dmca AT comcast DOT net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com DJ Delorie wrote: >>'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. Even faulty, if '(int)(c)+1' is not in range do we risk segfault or other awful outcome? Kaz' demons come to mind. -- Joe Wright mailto:joewwright AT comcast DOT net "Everything should be made as simple as possible, but not simpler." --- Albert Einstein ---