C++ use of bool
David Bryan
D.J.Bryan at cranfield.ac.uk
Thu May 4 17:50:51 BST 2000
In message <B64pWHAzSYE5Ew+D at mk-net.demon.co.uk>
Tony van der Hoff <OSLib at mk-net.demon.co.uk> wrote:
> It turns out (I think), that |bool| was introduced as a keyword only in
> the 1998 version of the C++ standard.
That sounds correct.
> It would be extremely useful if C++ 1998 conformant compilers (and in
> particular G++) were to identify themselves, much in the same way as C99
> does by means of a version macro.
They do. |__cplusplus >= 199711L|. However, g++ versions 2.95.2
and earlier do not completely conform to the 1998 standard, and so
have |__cplusplus == 1|. You can tell the version of GCC using
|__GNUC__| and |__GNUC_MINOR__|, ie.
printf("Compliled by GCC %d.%d\n", __GNUC__, __GNUC_MINOR__);
This could be used to tell if |bool| is a keyword. Although, I
wouldn't be surprised if every version of g++ ever produced has
|bool| as a keyword.
> I can't find any public domain access to the standard, so does anyone
> out there have access to it? If so, does it define a version macro? Does
> G++?
C++ is Working Group 21. See
http://anubis.dkuug.dk/JTC1/SC22/
The last freely available document was the FCD N2356 at
http://anubis.dkuug.dk/jtc1/sc22/open/n2356/
This is all separate HTML files. You can get it all bundled up
together at
ftp://ftp.maths.warwick.ac.uk/pub/c++/std/cd2/
There you can also get it as PostScript and PDF; I can't find
those formats on the official site.
The documentation for GCC is online at
http://gcc.gnu.org/onlinedocs/
Hope this helps.
--
David Bryan
More information about the oslib-user
mailing list