delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/13:03:27

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bool.h in C++
Date: Tue, 02 Sep 1997 08:56:12 -0700
Organization: Alcyone Systems
Lines: 21
Message-ID: <340C371C.D9D5E45@alcyone.com>
References: <42256506 DOT 00564D66 DOT 00 AT aks DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

eyal DOT ben-david AT aks DOT com wrote:

> bool.h itself didn't do much. just #defined bool, true, false  as int,
> 1, 0
> respectively.

Note this doesn't quite adhere to how bool is supposed to work. 
According to the draft standard, numeric and pointers values can
implicitly be converted to bool, even if they are not zero or one.  So 

    bool b = 3;

means that b should get true (1), not 3.  Simple #defines won't do that.

-- 
          Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                        Alcyone Systems / http://www.alcyone.com/max/
   San Jose, California, United States / icbm://37.20.07n/121.53.38w
                                      \
                  "War is like love; / it always finds a way."
                                    / Bertolt Brecht

- Raw text -


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