🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#90
From: Kevin Cline
Date: Fri, 19 Apr 1996 15:04
33 lines
1145 bytes
 In article <31770390.2781@llnl.gov>, 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.
 >
 >Scott Nelson

The real lesson here is to write
	if (x) 
or
	if (!x)

instead of
	if (x == true)
and
	if (x == false)

Then it doesn't matter what the value of true is, as long as it is not zero.  
-- 
Kevin Cline
Technical Details
Message-ID: <4l8a14$5g@tpd.dsccc.com>
Path: arc1-ca.pugleaf.net!camelot.dsccc.com!kcline
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!camelot.dsccc.com!kcline
From: kcline@sun132.spd.dsccc.com (Kevin Cline)
Newsgroups: comp.sys.sgi.apps,comp.lang.c++
Subject: Re: SGI's C++ compiler and the boolean type
Date: 19 Apr 1996 15:04:04 GMT
Organization: DSC Communications Corporation Switch Products Division
Message-ID: <4l8a14$5g@tpd.dsccc.com>
References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>
NNTP-Posting-Host: sun132.spd.dsccc.com