* Will __GXX_EXPERIMENTAL_CXX0X__ go away?
@ 2011-05-25 8:33 Patrick Horgan
2011-05-25 12:15 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: Patrick Horgan @ 2011-05-25 8:33 UTC (permalink / raw)
To: GCC-help
I'm using the following in a header that uses typeof and needs to build
in code that builds with -std=c++0x or the default -std=c++98. Can I
leave it and forget it, or will eventually the compiler's use of c++0x
features no longer be experimental? How do I future proof it?
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#define typeof decltype
#endif
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Will __GXX_EXPERIMENTAL_CXX0X__ go away?
2011-05-25 8:33 Will __GXX_EXPERIMENTAL_CXX0X__ go away? Patrick Horgan
@ 2011-05-25 12:15 ` Jonathan Wakely
2011-05-25 13:19 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-05-25 12:15 UTC (permalink / raw)
To: phorgan1; +Cc: GCC-help
On 25 May 2011 07:44, Patrick Horgan wrote:
> I'm using the following in a header that uses typeof and needs to build
> in code that builds with -std=c++0x or the default -std=c++98. Can I
> leave it and forget it, or will eventually the compiler's use of c++0x
> features no longer be experimental? How do I future proof it?
>
> #ifdef __GXX_EXPERIMENTAL_CXX0X__
> #define typeof decltype
> #endif
Yes it will go away at some point. The portable way to detect C++0x support is:
#if __cplusplus >= 201103L
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Will __GXX_EXPERIMENTAL_CXX0X__ go away?
2011-05-25 12:15 ` Jonathan Wakely
@ 2011-05-25 13:19 ` Jonathan Wakely
2011-05-26 12:12 ` Patrick Horgan
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2011-05-25 13:19 UTC (permalink / raw)
To: phorgan1; +Cc: GCC-help
On 25 May 2011 09:19, Jonathan Wakely wrote:
> On 25 May 2011 07:44, Patrick Horgan wrote:
>> I'm using the following in a header that uses typeof and needs to build
>> in code that builds with -std=c++0x or the default -std=c++98. Can I
>> leave it and forget it, or will eventually the compiler's use of c++0x
>> features no longer be experimental? How do I future proof it?
>>
>> #ifdef __GXX_EXPERIMENTAL_CXX0X__
>> #define typeof decltype
>> #endif
>
> Yes it will go away at some point. The portable way to detect C++0x support is:
>
> #if __cplusplus >= 201103L
Actually portable is the wrong word, since G++ doesn't actually
conform to that requirement - but it's the method specified by the
standard, so other compilers should conform to it and G++ should do
one day too.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Will __GXX_EXPERIMENTAL_CXX0X__ go away?
2011-05-25 13:19 ` Jonathan Wakely
@ 2011-05-26 12:12 ` Patrick Horgan
2011-05-26 16:52 ` Jonathan Wakely
0 siblings, 1 reply; 5+ messages in thread
From: Patrick Horgan @ 2011-05-26 12:12 UTC (permalink / raw)
To: gcc-help
On 05/25/2011 01:21 AM, Jonathan Wakely wrote:
> On 25 May 2011 09:19, Jonathan Wakely wrote:
>> On 25 May 2011 07:44, Patrick Horgan wrote:
>>> I'm using the following in a header that uses typeof and needs to build
>>> in code that builds with -std=c++0x or the default -std=c++98. Can I
>>> leave it and forget it, or will eventually the compiler's use of c++0x
>>> features no longer be experimental? How do I future proof it?
>>>
>>> #ifdef __GXX_EXPERIMENTAL_CXX0X__
>>> #define typeof decltype
>>> #endif
>> Yes it will go away at some point. The portable way to detect C++0x support is:
>>
>> #if __cplusplus >= 201103L
> Actually portable is the wrong word, since G++ doesn't actually
> conform to that requirement - but it's the method specified by the
> standard, so other compilers should conform to it and G++ should do
> one day too.
>
Yeah, the current draft (N3242) has this:
16.8 Predefined macro
names [cpp.predefined]
1 The following macro names shall be defined by the implementation:
_ _ cplusplus
The name _ _ cplusplus is defined to the value 201103L when compiling a
C++ translation unit.155
155) It is intended that future versions of this standard will replace
the value of this macro with a greater value. Non-conforming compilers
should use a value with at most five decimal digits.
right now gcc defines __cplusplus as 1, so maybe something like?
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
#define typeof decltype
#endif
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Will __GXX_EXPERIMENTAL_CXX0X__ go away?
2011-05-26 12:12 ` Patrick Horgan
@ 2011-05-26 16:52 ` Jonathan Wakely
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2011-05-26 16:52 UTC (permalink / raw)
To: phorgan1; +Cc: gcc-help
The current draft is n3290 but apart from that, yes that should detect
C++0x support
I hope that gcc will eventually define __cplusplus correctly too
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-25 22:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-25 8:33 Will __GXX_EXPERIMENTAL_CXX0X__ go away? Patrick Horgan
2011-05-25 12:15 ` Jonathan Wakely
2011-05-25 13:19 ` Jonathan Wakely
2011-05-26 12:12 ` Patrick Horgan
2011-05-26 16:52 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).