Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!brolga!uqcspe!batserver.cs.uq.oz.au!rhys From: rhys@batserver.cs.uq.oz.au (Rhys Weatherley) Newsgroups: comp.lang.c++ Subject: The __cplusplus macro - is it portable? Message-ID: <5954@uqcspe.cs.uq.oz.au> Date: 27 Nov 90 08:35:49 GMT Sender: news@uqcspe.cs.uq.oz.au Reply-To: rhys@batserver.cs.uq.oz.au Lines: 33 The subject should say it all :-). Basically, Turbo C++ has the macro __cplusplus which is defined when Turbo C++ is compiling using C++ conventions. This macro is handy for importing "standard C" routines by "wrapping up" their prototypes and definitions, etc in the following form: #ifdef __cplusplus extern "C" { #endif ... Plain ordinary C declarations and code ... #ifdef __cplusplus } #endif The 'extern "C"' declaration also appears to work in G++ (although I haven't tried __cplusplus yet), but mainly I'm asking if a standard ANSI or pre-ANSI macro does exist for this purpose. Is it __cplusplus, or something different, or isn't there one at all? This is of concern to me since I'm on a huge "portability drive" at the moment. So much for "dumb question number 437", but I'm sure lots of "portability freaks" out there would also be interested. Rhys. P.S. I didn't post to comp.std.c++ because different compilers may have different ways of doing this operation, which are "not standard". +===============================+==============================+ || Rhys Weatherley | University of Queensland, || || rhys@batserver.cs.uq.oz.au | Australia. G'day!! || +===============================+==============================+