From -8548555022718987248
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c6421e9689b6c205
X-Google-Attributes: gidf78e5,public
From: willer@sq.com (Steve Willer)
Subject: Re: How can I tell if my compiler supports the bool type?
Date: 1996/06/14
Message-ID: <m0uUb35-000OjNC@sqarc.sq.com>#1/1
X-Deja-AN: 160175338
references: <4pnpmp$14oq@ausnews.austin.ibm.com> <u9g27zcnrl.fsf@yorick.cygnus.com>
x-original-date: Fri, 14 Jun 96 11:44 EDT
organization: SoftQuad International, Toronto ON
x-auth: PGPMoose V1.1 PGP comp.std.c++
return-path: <daemon@migs.UCAR.EDU>
newsgroups: comp.std.c++


jason@cygnus.com (Jason Merrill) wrote:

>You can say
>
>#define bool int
>#define false 0
>#define true 1
>
>This will work on both kinds of compilers, so long as you don't try to use
>bool in ways that won't work on the old compilers anyway.

That's true to a point. But if bool is a builtin on a compiler, its
presence will therefore have different mangling from an int. If you're
using a library that wasn't written by you and was compiled with real
bools (like, for example, OWL 5), you'll get yourself into a mess of
trouble trying to pretend it's an int. Other than the obvious linking
errors, an example is if you are overriding a library class member that
returns a 'bool' with your own function that returns an 'int' -- that's
illegal.

----
Steve Willer, SoftQuad International, Toronto ON
Work: willer@sq.com    Personal: willer@interlog.com   CIS: 70400,3667
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]



