delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/14/10:57:08

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Mon, 14 Jun 1999 16:56:36 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: strtol
In-Reply-To: <Pine.SUN.3.91.990614164100.18221A-100000@is>
Message-ID: <Pine.LNX.3.93.990614165247.31120G-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 14 Jun 1999, Eli Zaretskii wrote:

> > On Sun, 13 Jun 1999, Morten Welinder wrote:

> > > It's subtle.  If s is a "char *" or "signed char *" and c is an int,
> > > then after "c = *s;", c is -27.  isdigit is only defined in the
> > > range -1 to 255.  (EOF is -1.)

> Does the following seem okay?  It works for me.

It may work, but it's a bit unclear. The cast to (unsigned char) would be
cleaner, I think. Or, for that matter, defining c as an unsigned char
variable straight away.

The rule is simple: a char that is to be passed to a <ctype.h> functions
must either already *be* a unsigned char, or be casted into one. 

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.


- Raw text -


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