Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: The __cplusplus macro - is it portable? Message-ID: <59577@microsoft.UUCP> Date: 5 Dec 90 18:01:14 GMT References: <5954@uqcspe.cs.uq.oz.au> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 16 In article <5954@uqcspe.cs.uq.oz.au> rhys@batserver.cs.uq.oz.au writes: >The subject should say it all :-). Page 383 of "The Annotated C++ Reference Manual" [Ellis & Stroustrup, Addison-Wesley, 1990 ISBN 0-201-51459-1] states that __cplusplus will be defined for all C++ implementations -- even those still using "Classic C" preprocessors. Page 379 states also that _cplusplus is defined -- when compiling C++ programs. The implication in my mind is that if one has a compiler smart enough to compile both C++ and "Classic C" programs, either noting the difference via compilation flags, filename extensions, or whatever, then __cplusplus is defined only in the C++ compilation case. IE this decision is made based on the flavor of the compilation, not the flavor of the compiler. Identical language is used in the working papers of the ANSI-C++ committee, and I believe __cplusplus is well supported in practice by actual C++ compilers. Brought to you by Super Global Mega Corp .com