testing for the definition of types

bridged with qdn.public.devtools
Post Reply
Bill Caroselli (Q-TPS)

testing for the definition of types

Post by Bill Caroselli (Q-TPS) » Thu Jul 11, 2002 8:05 pm

What is the proper way to test if my C++ compiler has defined 'bool' 'true'
& 'false'.

I want to write source code that will work for both QNX4 & 6 that use these.
Obviously if they aren't defined I want to define them.

#ifdef doesn't work

Adam Mallory

Re: testing for the definition of types

Post by Adam Mallory » Fri Jul 12, 2002 2:53 pm

You could take the route that many ./configure scripts take - build a small
program
with the symbols defined, if the build fails you know they are not defined
(or
at least not where you think they are).

Lather, rinse, repeat.

--
Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]
---------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster <pschon@baste.magibox.net>
"Bill Caroselli (Q-TPS)" <QTPS@EarthLink.net> wrote in message
news:agko3l$qu9$1@inn.qnx.com...
What is the proper way to test if my C++ compiler has defined 'bool'
'true'
& 'false'.

I want to write source code that will work for both QNX4 & 6 that use
these.
Obviously if they aren't defined I want to define them.

#ifdef doesn't work


Bill Caroselli (Q-TPS)

Re: testing for the definition of types

Post by Bill Caroselli (Q-TPS) » Fri Jul 12, 2002 5:23 pm

Right now I'm checking for the definition of __WATCOMC__. But I find it
hard to believe that with all of the cross platform development that's being
promoted today there isn't an ANSI standard way to determine if the
particular compiler I'm using, whatever it may be, has built in support for
'bool', 'true', 'false' and add to the list 'long long'.

The best thing about standards is that there are so many different ones to
choose from.

"Adam Mallory" <amallory@qnx.com> wrote in message
news:agmqe1$j58$1@nntp.qnx.com...
You could take the route that many ./configure scripts take - build a
small
program
with the symbols defined, if the build fails you know they are not defined
(or
at least not where you think they are).

Lather, rinse, repeat.

--
Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]
---------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster <pschon@baste.magibox.net
"Bill Caroselli (Q-TPS)" <QTPS@EarthLink.net> wrote in message
news:agko3l$qu9$1@inn.qnx.com...
What is the proper way to test if my C++ compiler has defined 'bool'
'true'
& 'false'.

I want to write source code that will work for both QNX4 & 6 that use
these.
Obviously if they aren't defined I want to define them.

#ifdef doesn't work




Post Reply

Return to “qdn.public.devtools”