🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: true/false literal std question

#1756
From: mfinney
Date: Mon, 21 Aug 1995 02:01
28 lines
1833 bytes
In <417kfc$1q3@engnews2.Eng.Sun.COM>, clamage@Eng.Sun.COM (Steve Clamage) writes:
>But that is not the case.
>
>There are no types in the preprocessor, not even literal chars. Chars
>and wide chars are treated as their integer values.  There are no enums,
>pointers, or floating-point values. The result of any comparison is the
>integer value 0 or 1.
>
>If true and false were introduced into the preprocessor, they would 
>have to be predefined to the preprocessor numbers 1 and 0.

Yes. So?  Why is that any different that treating 'a' as its integral value?
That is EXACTLY what I would expect.

> Why would this
>be superior to just using 1 and 0 in your code

Readablity.  The use of 'true' and 'false" as opposed to '1' and '0' when dealing
with logical issues is MUCH more readable.  I haven't used '1' and '0' in the
preprocessor for a logical condition since about my second day of writing C code
(which was a LONG time ago <g>).

Michael Lee Finney


[ 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: <41881c$ihs@mujibur.inmind.com>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <4167na$nv9@engnews2.Eng.Sun.COM> <416oev$71f@mujibur.inmind.com> <417kfc$1q3@engnews2.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: mfinney@inmind.com
Newsgroups: comp.std.c++
Subject: Re: true/false literal std question
Date: 21 Aug 1995 02:01:31 GMT
Organization: In Mind, Inc.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <41881c$ihs@mujibur.inmind.com>
References: <4167na$nv9@engnews2.Eng.Sun.COM> <416oev$71f@mujibur.inmind.com> <417kfc$1q3@engnews2.Eng.Sun.COM>
Reply-To: mfinney@inmind.com
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: finneyman.inmind.com
X-Newsreader: IBM NewsReader/2 v1.2
Content-Length: 961
Originator: clamage@taumet