From -5757171828497916842
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c6421e9689b6c205
X-Google-Attributes: gidf78e5,public
From: kcline@sun132.spd.dsccc.com (Kevin Cline)
Subject: Re: How can I tell if my compiler supports the bool type?
Date: 1996/06/14
Message-ID: <4ps098$2pv@tpd.dsccc.com>#1/1
X-Deja-AN: 160180151
x-lines: 30
x-nntp-posting-host: sun132.spd.dsccc.com
references: <4pnpmp$14oq@ausnews.austin.ibm.com>
content-length: 1135
organization: DSC Communications Corporation Switch Products Division
newsgroups: comp.std.c++
originator: clamage@taumet


In article <4pnpmp$14oq@ausnews.austin.ibm.com>,
Timur Tabi <timur@vnet.ibm.com> wrote:
 >I heard about the new bool type, and I'm looking forward to having it
 >supported in the compilers I use (Watcom's and IBM's).  In the meantime, I'd
 >like to use the new type in my current compilers, by doing something like:
 >
 >typedef int bool;	// or maybe I should do #define bool int?
 >#define false 0
 >#define true 1
 >
 >However, if I try this on a "bool-enabled" compiler, I'll probably get some
 >errors.  So what I need is something like:
 >
 >#ifndef bool
 >typedef int bool;
 >#define false 0
 >#define true 1
 >#endif
 >
 >But I don't think this is going to work.  Does anyone have any suggestions?
 >I want to place these statements into a generic headerfile that will compiler
 >under both kinds of compilers.

The only way to do this is to test the compiler directly by attempting
to compile a tiny test program, and then build the header file depending
on the success or failure of the compile.  But I am not a PC programmer,
so I don't know if there is a scripting language powerful enough to
accomplish it.
-- 
Kevin Cline


[ 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                             ]



