views:

439

answers:

6

We are going to start a long lasting project using C++ as the programming language.

I read that C++0x is going to come out in 2011, so they called it C++11.

When C++11 comes out, we will still be developing the project, and would like to know if it is possible to use any features of the new C++ standard now, to able to:

  • code faster than with the old C++ and
  • switch easily when the new standard arrives?
A: 

Hi, it depends which compiler you are using.

As an example, GCC has the tr1 extension which contains some features that will be in C++11.

kotlinski
There is no compiler limitation. The only requirement is using the Rogue Wave Library.. so i am free with compiler settings.
camelord
+2  A: 

Visual C++ 2010 and latest gcc versions (-std=c++0x) have support for new features of C++11, but not all of them. In particular, you could start using the new initializer syntax with braces; that is IMHO the biggest syntax change in C++11. It is also the change that would add the most inconsistencies in your code, if one part uses C++98 style and the other uses C++11 style.

Didier Trosset
VS2010 is yet to come out. I am sure no product development would be happening on a non-GM product.
dirkgently
It will be out in a couple of months. The question is: "Is there gonna be a release till then?" If the answer is no, then using the beta right now to start will avoid a migration.
Didier Trosset
sorry, what is a non-GM product?
camelord
GM(Grand Master)==Release
dirkgently
ah ok, youre right. GM is a must..
camelord
+10  A: 

This page shows the parts of C++0x supported by gcc(main Unix compiler), MSVC(main Microsoft compiler) and a few others(including Intel). Extra info for Clang is here although I think their c++ support for current standards is still incomplete.

Roman A. Taycher
I think the recent clang releases claim to support the 2003 standard fully.
Roman A. Taycher
+4  A: 

Just because a standard comes out does not mean that the compilers magically get updated - it took years for most compilers to provide reasonable support for the previous standard, and some features never got supported much, such as export (dropped from C++0x). Depending on first implementations of new features si not a great strategy either - I prefer to let others be experimenters, if I'm working to a deadline.

Also, I wouldn't be too fast to call it C++11 - the standards process is fraught with possibilities for delay.

Edit: I see you are using the RW libraries. In which case, probably many features of the new Standard won't be of immediate interest, as they are aimed at template writers and users of the C++ Standard library.

anon
using the new standard does not mean the 'old' C++ cannot be used anymore. Meaning the software architekture can be build that way to use old C++ as interface to the RW Library and the new C++ for the rest of the Application..
camelord
Not "magically", through hard work. I think (hope?) that C++0x compilers will be in fairly good shape when the standard is published. For example I'm sure Sutter has said on his blog that MS is shadowing the drafts as closely as it practically can, and that it currently intends for its first major release after publishing to be compliant (anyway as compliant as it currently is to C++03, so as good as you're used to). I'd have thought one of the more likely reasons for a significant publishing delay is if one or more major compilers highlights difficulties in implementing the changes.
Steve Jessop
@Steve: Don't suppose you have a link to that statement from Sutter? Anyway, if they can pull off a reasonably compliant version by 2012'ish (which is presumably when the next VS is targeted for), that'd be nice. :)
jalf
@jalf: sorry, can't find it by searching. When I say "I'm sure", that's exaggeration: "I think". It's possible I've mis-remembered comments about partial C++0x support. Please don't base your business plan on my fallible memory of Sutter's non-promise ;-)
Steve Jessop
Well, i guess i just work with the new MFC and TB1. Seems like it can last a long time to use a C++0x Release.Thx for youre answers..
camelord
+1  A: 

Don't think of it as switching to all the new features at once. Evaluate each new language feature on it's own merits, and the quality of its implementation.

For instance long long has been a fairly common compiler extension even before it was considered for C++0x, and the new auto syntax is useful and likely to be well-supported. You may want to be very cautious with some complicated combination of several new features like type inference with decltype for a function with the new -> syntax inside a class using variadic templates and the new rules for parsing >>.

P-Nuts
+1  A: 

Scott Meyers (author of the "Effective C++" series) uploaded just last week the following:

Summary of C++0x Feature Availability in gcc and MSVC

This is, in a sense, similar to another link mentioned in a different answer on this thread. The main difference is that Meyers' link only contains stuff he's tried out himself. I expect it will keep getting updated in the months to come.

Also, and this is how I found out about this, he implied on comp.std.c++ that he is working on something related to C++0x educational material (apparently beyond his training course) but this is all too speculative right now, so let's just stick to the first link I provided above.

Alexandros Gezerlis