Mail Archives: djgpp/1999/04/13/14:10:27

From: G DOT A DOT Patterson AT _btinternet DOT com (Graham A. Patterson)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: BOOL as char/int
Date: Tue, 13 Apr 1999 17:45:48 GMT
Organization: The House of Hector
Message-ID: <>
References: <7ev4na$49a$1 AT lola DOT ctv DOT es>
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 17
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Rafael García" <rafael AT geninfor DOT com> wrote:
>typedef char /*int*/ BOOL;
>#define TRUE 1
>#define FALSE 0

Well, FALSE can reasonably be assumed to be zero.  But there is
nothing to say (in the various standards for C, C++, or C9X) that TRUE
is necessarily one.  It is any non-zero number, including negative.

Make tests against FALSE by all means, but testing for 'TRUE' as a
specific value is asking for trouble. 

       Graham Patterson

*** Unless otherwise stated, opinions expressed are mine ***

- Raw text -

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