Date: Sun, 1 Feb 1998 19:51:48 +0200 (IST) From: Eli Zaretskii To: Vik Heyndrickx cc: djgpp-workers AT delorie DOT com Subject: Re: char != unsigned char... sometimes, sigh In-Reply-To: <34D185D3.302@rug.ac.be> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 30 Jan 1998, Vik Heyndrickx wrote: > Another thought to support the idea for changing the 'char' default from > 'signed char' to 'unsigned char' is that the is* macros from > are ALL buggy because they do not select the proper array element for > the argument being EOF. Are you sure? Unless I'm missing something, the ctype macros should work for -1: #define isalnum(c) (__dj_ctype_flags[((c)&0xff)+1] & __dj_ISALNUM) That "+1" is designed to make EOF be 0, and the zeroth element of __dj_ctype_flags[] array should be set appropriately. Doesn't this work? > Because a LOT of programs actually rely on the fact that the is* macros > should work on a 'char', someone made this macro cast the 'c' argument > to an 'unsigned char' (i.e. ANDs it with 0xff), and this works of course > well for any 'signed char' and 'unsigned char', but not for EOF. Please explain why do you think this doesn't work for EOF.