🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: What!!! true and false not identifiers?

#1571
From: Trebor A. Rude
Date: Thu, 03 Aug 1995 13:20
40 lines
1735 bytes
In Article<3vo825$k9n@engnews2.Eng.Sun.COM>, <clamage@Eng.Sun.COM> write:
 
> For compatibility with existing code during the transition period, you can
> place something like the following in a project header file:
> 
>     #ifdef NO_BOOL_TYPE
> 	typedef int bool; // allows implicit conversions but not overloading
> 	const bool false = 0;
> 	const bool true = 1;
>     #endif
> 
> and then #define NO_BOOL_TYPE for compilers which do not yet support bool.
> An alternative, which does not allow implicit conversions but which does
> allow overloading on bool would be
> 
> 	enum bool { false, true };
> 
> ---
> Steve Clamage, stephen.clamage@eng.sun.com
> 
> 

An alternitive that would allow both overloading and implicit type
conversions is something like this:

enum BOOLEAN { false, true };

class bool {
   BOOLEAN value;
public:
    // Put in type conversion, operators, etc.
}

Granted, it takes two identifiers, but I think it comes closest to
implementing the type as the draft standard does (at least among
what I've seen so far).

Trebor A. Rude
trebor@en.ecn.purdue.edu
Technical Details
Message-ID: <NEWTNews.807452778.29822.Trebor@eagle.lute.qnet.com>
Path: arc1-ca.pugleaf.net!news.gcr.com!usenet
References: <fwv3ffkzm98.fsf@oculus.aifh.ed.ac.uk> <3vo825$k9n@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.gcr.com!usenet
From: "Trebor A. Rude" <trebor@en.ecn.purdue.edu>
Newsgroups: comp.std.c++
Subject: Re: What!!! true and false not identifiers?
Date: Thu, 03 Aug 95 13:20:37 xED
Organization: Quantum Networking Solutions; Virginia, USA; info@qnet.com
Message-ID: <NEWTNews.807452778.29822.Trebor@eagle.lute.qnet.com>
References: <fwv3ffkzm98.fsf@oculus.aifh.ed.ac.uk>  <3vo825$k9n@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: dialup00.wdbg.va.qnet.com
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage