[gnu.g++] predefined macros

ALLEN@SSCVX1.SSC.GOV (02/10/90)

I want to use the same header file for both c and c++, so
with cfront 1.2 I did "#ifdef c_plusplus".  I am using g++-1.36.4
based on gcc-1.36.94, which defines __GNUG__, but not c_plusplus.
Is there a better sol'n than cheking for __GNUG__ and putting
off the problem of a different c++ compiler till I actually
have a different c++ compiler?

Thanks,
allen@sscvx1.ssc.gov
Michael Allen

rfg@ics.uci.edu (Ronald Guilmette) (02/10/90)

In article <900209124736.20205279@SSCVX1.SSC.GOV> ALLEN@SSCVX1.SSC.GOV writes:
>I want to use the same header file for both c and c++, so
>with cfront 1.2 I did "#ifdef c_plusplus".  I am using g++-1.36.4
>based on gcc-1.36.94, which defines __GNUG__, but not c_plusplus.
>Is there a better sol'n than cheking for __GNUG__ and putting
>off the problem of a different c++ compiler till I actually
>have a different c++ compiler?

What's wrong with:

	#if defined(c_plusplus) || defined(__GNUG__)

Actually, the "right" way to do this nowadays is:

	#if defined (__cplusplus)

// rfg