www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/02/02/20:04:37

Date: Mon, 2 Feb 1998 18:24:11 -0500 (EST)
Message-Id: <199802022324.SAA16676@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp-workers AT delorie DOT com
In-reply-to: <Pine.SUN.3.91.980202185623.19322E-100000@is> (message from Eli
Zaretskii on Mon, 2 Feb 1998 18:56:40 +0200 (IST))
Subject: Re: char != unsigned char... sometimes, sigh

> Will the following solve the problem?
> 
>   #define isalnum(c) (__dj_ctype_flags[((c)+1)&0xff] & __dj_ISALNUM)

No, because the problem is that EOF ((int)-1) and 0xff ((int)(signed
char)-1) ARE THE SAME NUMBER.  No amount of logic can tell the
difference.

What started this thread was an idea to make (char) mean (unsigned
char) so that -1 and (char)(0xff) would be different numbers when
promoted to (int).  That, unfortunately, has many other bad side
effects.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019