Topic: __cplusplus
Author: rado42 <rado42@my-deja.com>
Date: 1999/10/02 Raw View
Hi
I asked this question some days ago, but it never appeared in the
newsgoup.
Does anybody know if __cplusplus is standard #define for C++?
Dear moderator:
If you regected my post, do you know the answer?
--
rado
http://members.tripod.com/~radosoft
Sent via Deja.com http://www.deja.com/
Before you buy.
[ moderator's note: The question as posed would not have been rejected,
because it concerns the C++ standard. As explained in the newsgroup
FAQ, when a post is rejected, the rejection notice is sent to the
email address in the submitted article -- the one automatically
supplied in the newsgroup headers, unless there is a different one
in the body of the message. If you do not supply a valid email
address, you can't be notified of the rejection. Sometimes
submissions get lost, for any number of reasons. -sdc ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: clamage@eng.sun.com (Steve Clamage)
Date: 1999/10/02 Raw View
rado42 <rado42@my-deja.com> writes:
>Does anybody know if __cplusplus is standard #define for C++?
Yes. Every C++ compiler since about 1991 has defined __cplusplus
as a macro.
A standard-conforming compiler is required to define it to
the value 199711. The mysterious number is the date the
standard was voted out of committee: November 1997.
--
Steve Clamage, stephen.clamage@sun.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Darin Adler" <darin@bentspoon.com>
Date: 1999/10/02 Raw View
rado42 <rado42@my-deja.com> wrote:
> Does anybody know if __cplusplus is standard #define for C++?
Yes. It is. The standard requires it; this is found in paragraph 16.8/1.
-- Darin
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Sean L. Palmer" <seanpalmer@mindspring.com>
Date: 1997/03/19 Raw View
> >And a standard way for compiler vendors to identify themselves and their
> >compiler version?
>
> Compilers already have ways of doing that.
>
> >#elif __compiler == __gnu
>
> Why would that be any better than
>
> #elif __GNUC__
>
> ?
Because none of the vendors can make up their minds how they want to do it.
#if defined(_MSC_VER)
//
#elif defined(__BORLANDC__)
//
#elif defined(__WATCOM_CPLUSPLUS__)
//
#elif defined(__GNUC__)
//
#endif
as you can see there are several ways for them to do it, and of course they
will.
This still leaves us with the problem of determining compiler version.
Admittedly the compiler versions themselves are going to vary wildly.
The POINT is that there should be a STANDARD way to determine these things.
This is a STANDARD right?
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: "Sean L. Palmer" <seanpalmer@mindspring.com>
Date: 1997/03/16 Raw View
> C++ compilers use to #define __cplusplus which can be used by source code
> to check whether a C or C++ compiler is in use. Will that be part of the
> C++ standard?
>
> [Yes. See 16.8[cpp.predefined]/1 in the draft working paper.
> -moderator (fjh).]
What about draft/standard revision identification?
#if __cplusplus >= 19970211 //Feb '97 standard or later?
#endif
And a standard way for compiler vendors to identify themselves and their
compiler version?
#if __compiler == __msvc
#elif __compiler == __borland
#elif __compiler == __watcom
#elif __compiler == __gnu
#endif
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Date: 1997/03/16 Raw View
"Sean L. Palmer" <seanpalmer@mindspring.com> writes:
>> C++ compilers use to #define __cplusplus which can be used by source code
>> to check whether a C or C++ compiler is in use. Will that be part of the
>> C++ standard?
>>
>> [Yes. See 16.8[cpp.predefined]/1 in the draft working paper.
>> -moderator (fjh).]
>
>What about draft/standard revision identification?
>
>#if __cplusplus >= 19970211 //Feb '97 standard or later?
>#endif
See 16.8[cpp.predefined]/1!
If you read that, you will see that the Feb 97 draft requires
that __cplusplus be defined as `199711L'. So you should use
#if __cplusplus >= 199711 //Feb '97 standard or later?
...
#endif
>And a standard way for compiler vendors to identify themselves and their
>compiler version?
Compilers already have ways of doing that.
>#elif __compiler == __gnu
Why would that be any better than
#elif __GNUC__
?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Ross Smith <ross.smith@nz.eds.com>
Date: 1997/03/17 Raw View
Fergus Henderson wrote:
>
> See 16.8[cpp.predefined]/1!
> If you read that, you will see that the Feb 97 draft requires
> that __cplusplus be defined as `199711L'. So you should use
>
> #if __cplusplus >= 199711 //Feb '97 standard or later?
> ...
> #endif
The draft is dated 2-Dec-96, and was presumably written in November.
Would I be right in guessing that the "199711L" in the draft is a typo,
and it's meant to be "199611L"?
--
Ross Smith .................................... Wellington, New Zealand
Webmaster, EDS (New Zealand) Ltd ....... <mailto:ross.smith@nz.eds.com>
"I'm as interested as anybody else in all the things no decent
person would be interested in." -- Ashleigh Brilliant
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: Matt Austern <austern@sgi.com>
Date: 1997/03/17 Raw View
Ross Smith <ross.smith@nz.eds.com> writes:
> Fergus Henderson wrote:
> >
> > See 16.8[cpp.predefined]/1!
> > If you read that, you will see that the Feb 97 draft requires
> > that __cplusplus be defined as `199711L'. So you should use
> >
> > #if __cplusplus >= 199711 //Feb '97 standard or later?
> > ...
> > #endif
>
> The draft is dated 2-Dec-96, and was presumably written in November.
> Would I be right in guessing that the "199711L" in the draft is a typo,
> and it's meant to be "199611L"?
No. That value is supposed to be the date when the C++ standard
becomes final. It has always been understood that the number in the
draft is basically a placeholder: the project editor will replace it
with the appropriate date when the time comes.
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: d96-mst@nada.kth.se (Mikael Steldal)
Date: 1997/03/08 Raw View
C++ compilers use to #define __cplusplus which can be used by source code
to check whether a C or C++ compiler is in use. Will that be part of the
C++ standard?
[Yes. See 16.8[cpp.predefined]/1 in the draft working paper.
-moderator (fjh).]
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]