delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/02/10/06:24:03

Date: Tue, 10 Feb 1998 13:23:26 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: DJ Delorie <dj AT delorie DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: char != unsigned char... sometimes, sigh
In-Reply-To: <34E00C85.57DE@rug.ac.be>
Message-ID: <Pine.SUN.3.91.980210131929.12622I-100000@is>
MIME-Version: 1.0

On Tue, 10 Feb 1998, Vik Heyndrickx wrote:

> #define isupper(c) ({int t=(c);unsigned v;\
>                      ++t;\
>                      if(t<0)t+=256;\
>                      v=__dj_ctype_flags[t];\
>                      (v&__dj_ISUPPER)!=0;})

I think it is better to have the temporary variables' names begin with an 
underscore.  Otherwise, if the program which uses this macro defines a 
variable named `t', gcc will print warning about inner variable which 
shadows the outer one (given the right -Wxxx switches).  Variables that 
begin with underscores are less frequent and ANSI reserves them anyway.

Note that I didn't try to compile this, so I might be wrong.

- Raw text -


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