Mail Archives: djgpp/1998/10/23/06:25:10
Mike Ruskai <thanny AT spambegone DOT home DOT com> wrote:
> On Thu, 22 Oct 1998 21:05:22 +0100, D. Vrabel wrote:
>>false and true are keywords in C++ (I asume your talking about C++). Use
>>the bool type for boolean variables.
> Since when? They aren't in the other two compilers, which is what makes the
> above necessary.
Then the other two are not adhering to the (upcoming?) standards. The
Dec 1996 C++-draft already stated (see below)
gcc has done this since 2.7.x (i think, 2.6.3 didn't follow the draft
AFAIK. Was there a draft back then?)
It's easy to work around. Use
#if ! (defined( __GNUC__) && defined(__cplusplus))
enum bool {false=0, true=1};
#endif
and use bool throughout your code.
==== quote from draft: ====
2.11 Keywords [lex.key]
1 The identifiers shown in Table 3 are reserved for use as keywords
(that is, they are unconditionally treated as keywords in phase 7):
Table 3--keywords
+-----------------------------------------------------------------------+
|asm do inline short typeid |
|auto double int signed typename |
|bool dynamic_cast long sizeof union |
|break else mutable static unsigned |
|case enum namespace static_cast using |
|catch explicit new struct virtual |
|char extern operator switch void |
|class false private template volatile |
|const float protected this wchar_t |
|const_cast for public throw while |
|continue friend register true |
|default goto reinterpret_cast try |
|delete if return typedef |
+-----------------------------------------------------------------------+
=== end quote from draft ===
See (same draft):
http://www.csci.csusb.edu/dick/c++std/cd2/lex.html#lex.key
http://www.cygnus.com/misc/wp/dec96pub/lex.html#lex.key
http://www.maths.warwick.ac.uk/cpp/pub/wp/html/cd2/lex.html#lex.key
hth,
Robert.
--
rjvdboon AT cs DOT vu DOT nl | "En dat is niet waar!" sprak ex-Staatsecretaris-
www.cs.vu.nl/~rjvdboon | van-Onderwijs Netelenbos fel.
- Raw text -