C++ use of bool

David J. Ruck druck at freeuk.com
Thu May 4 21:23:03 BST 2000


On Thu 04 May, David Bryan wrote:
> 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 thought we had pretty much agreed to typedef our own variable to
avoid having masses of compiler specific preprocessor statements to
try and determine the compiler and its particular feature set -
leaving you extreamly prone to problems with unexpected versions.

I'd like to use BOOL as it is already in common use in libraries 
and user code, but for probably this reason osbool is better as
it avoids the possibilty that BOOL isn't typedef'd to int.

Cheers
---Dave

-- 
______________________________________________________________________

  David J. Ruck     Phone: 07974 108301     Email: druck at freeuk.com
______________________________________________________________________




More information about the oslib-user mailing list