Mail Archives: djgpp-workers/1998/02/01/13:18:17
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 <ctype.h>
> 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.
- Raw text -