delorie.com/archives/browse.cgi | search |
Date: | Sun, 1 Feb 1998 14:14:10 -0500 (EST) |
Message-Id: | <199802011914.OAA20468@delorie.com> |
From: | DJ Delorie <dj AT delorie DOT com> |
To: | eliz AT is DOT elta DOT co DOT il |
CC: | Vik DOT Heyndrickx AT rug DOT ac DOT be, djgpp-workers AT delorie DOT com |
In-reply-to: | <Pine.SUN.3.91.980201195130.16390L-100000@is> (message from Eli |
Zaretskii on Sun, 1 Feb 1998 19:51:48 +0200 (IST)) | |
Subject: | Re: char != unsigned char... sometimes, sigh |
> #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? Given -1, you end up with (-1 & 0xff) + 1, which is 256. You get the same results for 0xff. Unfortunately, you can't tell the difference between -1 meaning EOF and -1 meaning signed character 0xff sign-extended and stored in a signed int variable (0xffffffff).
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |