🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: true/false literal std question

#1741
From: Steve Clamage
Date: Fri, 18 Aug 1995 22:51
24 lines
1707 bytes
In article qnk@mujibur.inmind.com, mfinney@inmind.com writes:
>The draft standard introduces two new reserved identifiers -- "true" and "false"
>(among others, of course).  These play the role of literals for the new bool type.
>
>My question, is: are these new literals supported by the preprocessor?  The new
>bool type is designed to replace the many variants of "boolean", "true" and
>"false" found everywhere.  However many, if not most, of the existing
>definitions can be used in preprocessor expressions.  If it is NOT possible to use
>the new true/false literals in preprocessor expressions then they will have to
>be duplicated just for preprocessing -- obviously not desirable.

They are language keywords, and are not interpreted by the preprocessor.
Just as you do not have 'int', 'char', or 'double' in the preprocessor,
you do not have 'bool' either. 'true' and 'false' are not aliases for 1
and 0, they are literals of type bool.

There are no types in the preprocessor; everything is a long integer.  

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.

---
Steve Clamage, stephen.clamage@eng.sun.com
Technical Details
Message-ID: <4135i2$744@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!usenet
References: <40jjuu$qnk@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!usenet
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: true/false literal std question
Date: 18 Aug 1995 22:51:46 GMT
Organization: Sun Microsystems Inc.
Approved: stephen.clamage@eng.sun.com (comp.std.c++)
Message-ID: <4135i2$744@engnews2.Eng.Sun.COM>
References: <40jjuu$qnk@mujibur.inmind.com>
Reply-To: clamage@Eng.Sun.COM
NNTP-Posting-Host: taumet.eng.sun.com