Article View: comp.std.c++
Article #1584Re: What!!! true and false not identifiers?
From: Wil Evers
Date: Fri, 04 Aug 1995 14:53
Date: Fri, 04 Aug 1995 14:53
24 lines
1375 bytes
1375 bytes
In article <fwv3ffkzm98.fsf@oculus.aifh.ed.ac.uk>
andrewfg@oculus.aifh.ed.ac.uk (Andrew Fitzgibbon) writes:
> I don't believe it! true and false are keywords, at least according to
> g++, which gets a parse error on this code.
>
> f() {
> int true = 0; // parse error
> }
>
> Why?
Believe it or not, but according to the draft ANSI/ISO standard, C++ now
has a built-in boolean type which uses the keywords 'bool', 'false' and
'true'. Regular readers of this newsgroup will tell you the introduction
of the built-in bool into the language is a highly controversial decision,
not only because many people think we don't need such a thing, but also
because the built-in bool has been substantially cluttered with
non-boolean operations for backward compatibility.
However, if I may say so, your example shows the built-in bool may have
some merit after all. Setting a variable named `true' to zero is asking
for trouble. Under the new rules, this is no longer possible.
- Wil
Technical Details
Message-ID:
<1995Aug4.145344.1419@ittpub>Path:
arc1-ca.pugleaf.net!EU.net!sun4nl!ittpub!ittpub!nntpReferences:
<fwv3ffkzm98.fsf@oculus.aifh.ed.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!EU.net!sun4nl!ittpub!ittpub!nntp Newsgroups: comp.std.c++ Subject: Re: What!!! true and false not identifiers? Message-ID: <1995Aug4.145344.1419@ittpub> From: wil@ittpub.nl (Wil Evers) Date: 4 Aug 95 14:53:44 WET References: <fwv3ffkzm98.fsf@oculus.aifh.ed.ac.uk> Distribution: world Nntp-Posting-Host: beelzebub