🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.apps
Article #91

Re: SGI's C++ compiler and the boolean type

#91
From: Mike Rubenstein
Date: Sat, 20 Apr 1996 02:37
28 lines
1062 bytes
Scott Nelson <nelson18@llnl.gov> wrote:

> Arthur Hagen wrote:
> > 
> > >
> > > typedef int     bool;
> > > #define true    1
> > > #define false   0
> > 
> > And some argue that true should be -1, because then bitwise not works:
> > 
> 
> We use the following.  It's safe on all platforms:
> 
> #define FALSE    0
> #define TRUE   (!0)
> 
> Let the built-in ! operator determine what TRUE really is.

How is that safer than

	#define FALSE 0
	#define TRUE 1

!0 is guaranteed to be 1 in both C and C++.


Michael M Rubenstein
Technical Details
Message-ID: <31784d88.187788215@nntp.ix.netcom.com>
Path: arc1-ca.pugleaf.net!ix.netcom.com!news
References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!news
From: miker3@ix.netcom.com (Mike Rubenstein)
Newsgroups: comp.sys.sgi.apps,comp.lang.c++
Subject: Re: SGI's C++ compiler and the boolean type
Date: Sat, 20 Apr 1996 02:37:25 GMT
Organization: Netcom
Message-ID: <31784d88.187788215@nntp.ix.netcom.com>
References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>
NNTP-Posting-Host: ix-dc12-18.ix.netcom.com
X-NETCOM-Date: Fri Apr 19  9:34:34 PM CDT 1996
X-Newsreader: Forte Agent .99d/32.182