🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1799

Re: true/false literal std question

#1799
From: Robert Mollitor
Date: Tue, 22 Aug 1995 08:12
40 lines
1719 bytes
Steve Clamage, stephen.clamage@eng.sun.com:
> You could #define something other than 'true' and 'false' (e.g. True, False)
> to have the values 1 and 0 if you want, or you could just use the built-in 
> zero/not-zero dichotomy.

But if the preprocessor doesn't "understand" 'true' and 'false', then what
stops someone from defining

  #define true 1
  #define false 0

(leaving aside the perverse case of actually reversing the values).
Unlike when playing with other keywords, this one causes none but the most
subtle bugs ("cout << true;", etc.).

If the real reason is that no one wants to touch the preprocessor, please
say that.  I don't think there is an abstract reason that the preprocessor
should not handle

  #define WANT_FOO true
  #define WANT_BAR false

  #if (WANT_FOO)
  ...
  #endif

  #if (WANT_BAR)
  ...
  #endif



robt
--
Robert Mollitor						      robert@visix.com
Visix Software Inc.					...!uupsi!visix!robert
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <ROBERT.95Aug21123621@mirage.visix.com>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <40jjuu$qnk@mujibur.inmind.com> <4135i2$744@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 22 Aug 95 08:12:44 GMT
Approved: fjh@cs.mu.oz.au
Return-Path: <daemon@ncar.UCAR.EDU>
From: robert@Visix.COM (Robert Mollitor)
Newsgroups: comp.std.c++
Subject: Re: true/false literal std question
X-Original-Date: 21 Aug 1995 16:36:21 GMT
Organization: Visix Software, Inc.
Message-ID: <ROBERT.95Aug21123621@mirage.visix.com>
References: <40jjuu$qnk@mujibur.inmind.com> <4135i2$744@engnews2.Eng.Sun.COM>
In-Reply-To: clamage@Eng.Sun.COM's message of 18 Aug 1995 22:51:46 GMT