www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/13/11:02:53

Message-Id: <m10X4gw-000S8ZC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "Rafael Garc a" <rafael AT geninfor DOT com>, djgpp AT delorie DOT com
Date: Tue, 13 Apr 1999 12:06:00 +0000
MIME-Version: 1.0
Subject: Re: BOOL as char/int
In-reply-to: <7ev4na$49a$1@lola.ctv.es>
X-mailer: Pegasus Mail for Windows (v2.54)
X-MIME-Autoconverted: from Quoted-printable to 8bit by delorie.com id LAA11664
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

"Rafael Garcİa" <rafael AT geninfor DOT com> asked:

> It fails with BOOL as char, but works as int
> Can someone explain this reasonably?
> It works well with Borland
> I have been using this typedef for years and it seems standard, robust,
> good, pretty, simple, near-machine, fast, compact...
> It seems gods of chaos are conquering the world of computing

Nope, you must read the specs, this function returns:

1) An int.
2) Nonzero if C is whitespace, else zero.

So it could return 0x100 and your char will be 0.
You should use:

a= isspace(b) ? 1 : 0;

SET


 
------------------------------------ 0 --------------------------------
Visit my home page: http://welcome.to/SetSoft
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(5411) 4759 0013

- Raw text -


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