Mail Archives: djgpp-workers/1998/02/05/03:48:36
Eli Zaretskii wrote:
> This thread was born out of a concern that our ctype functions don't
> support EOF. ANSI C requires this support. Knowing that funny things
> will happen in this case doesn't seem to help a bit when we face the sad
> conclusion that our libc is not fully compliant with the ANSI C standard.
Hmmm, tough to optimize.
> Can you suggest a change for the macros?
#define isalnum(c) ( ((unsigned)(c)>255) ? 0 :
__dj_ctype_flags[((c)&0xff)+1] & __dj_ISALNUM)
However, this will break all side-effect rules :(
So maybe:
#define isalnum(c) ({ unsigned _c=c; ((unsigned)(_c)>255) ? 0 :
__dj_ctype_flags[((_c)&0xff)+1] & __dj_ISALNUM; })
Will the above work and be satisfactory? If isalnum is passed a signed
char, 0x80-0xff will ofcourse fail, even if locale says those chars can
be alnums (does that happen?).
Bill
--
Leave others their otherness.
- Raw text -