The pre-processor for GCC will define the macro __GNUC__, so by testing
for this, one can tell if the GNU compiler was used. Can anyone tell me
a macro which an IBM compiler will define, so I can test for an IBM
compiler?
dave
--
I respectfully request that this message is not archived by companies as
unscrupulous as 'Experts Exchange' . In case you are unaware,
'Experts Exchange' take questions posted on the web and try to find
idiots stupid enough to pay for the answers, which were posted freely
by others. They are leeches.
|
|
0
|
|
|
|
Reply
|
foo25 (218)
|
8/19/2009 10:17:04 PM |
|
Dave schrieb:
> The pre-processor for GCC will define the macro __GNUC__, so by testing
> for this, one can tell if the GNU compiler was used. Can anyone tell me
> a macro which an IBM compiler will define, so I can test for an IBM
> compiler?
I'm not aware a specific macro of this kind exists.
The configuration file (/etc/vac.cfg) usually defines stuff like
-D_AIX,-D_AIX32,-D_AIX41,-D_AIX43,-D_AIX50,-D_AIX51,-D_AIX52,-D_AIX53,-D_IBMR2,-D_POWER
so you might use sth like
#if defined(_AIX) && !defined(__GNUC__)
However, with my humble self-written stuff I almost never
found it necessary to distinguish between different compilers
for the same platform. C and possibly C++ as well are so well
standardized these days that it almost makes no difference
as far as source code is concerned.
The latest IBM compilers even have switches and options
mimicking those of their gcc counterparts.
|
|
0
|
|
|
|
Reply
|
M.Kraemer (1958)
|
8/20/2009 7:46:59 AM
|
|
Michael Kraemer wrote:
> Dave schrieb:
>> The pre-processor for GCC will define the macro __GNUC__, so by
>> testing for this, one can tell if the GNU compiler was used. Can
>> anyone tell me a macro which an IBM compiler will define, so I can
>> test for an IBM compiler?
>
> I'm not aware a specific macro of this kind exists.
> The configuration file (/etc/vac.cfg) usually defines stuff like
>
> -D_AIX,-D_AIX32,-D_AIX41,-D_AIX43,-D_AIX50,-D_AIX51,-D_AIX52,-D_AIX53,-D_IBMR2,-D_POWER
>
>
> so you might use sth like
> #if defined(_AIX) && !defined(__GNUC__)
Thank you.
> However, with my humble self-written stuff I almost never
> found it necessary to distinguish between different compilers
> for the same platform. C and possibly C++ as well are so well
> standardized these days that it almost makes no difference
> as far as source code is concerned.
> The latest IBM compilers even have switches and options
> mimicking those of their gcc counterparts.
>
If I was writing the code myself from scratch, I would not be worrying
about this. Unfortunately, the Sage project (you see my other note) has
code from many sources, some of which does things like pass flags
directly to the linker. The options for building shared libraries in
particular vary somewhat.
--
I respectfully request that this message is not archived by companies as
unscrupulous as 'Experts Exchange' . In case you are unaware,
'Experts Exchange' take questions posted on the web and try to find
idiots stupid enough to pay for the answers, which were posted freely
by others. They are leeches.
|
|
0
|
|
|
|
Reply
|
foo25 (218)
|
8/21/2009 11:56:45 PM
|
|
|
2 Replies
44 Views
(page loaded in 0.102 seconds)
|