Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What stable c++11 feature can be used safely [closed]

Tags:

c++

c++11

What are the C++11 features that have got enough mature that I can start using safely in my projects. I am talking about GCC mainly I rarely need Visual Studio. and I obviously don't want to include a feature in my code that requires a rewrite after few months. and should I even start using these features in this very beginning ? cause whatever we mostly do is not c++11 dependent we can do all things and every things in old school methods too. so should we even start using C++11 features at this early stage ?

like image 911
Neel Basu Avatar asked Oct 19 '11 19:10

Neel Basu


1 Answers

The C++11 standard is finally done and published, so there won't be any more changes. Implementations still lag behind a little and may implement slightly older versions of C++0x, but you probably won't notice much difference when they are updated.

C++11 isn't perfectly backwards compatible, so the first thing you should do is start developing with C++11 compatibility in mind. GCC has a warning flag, "-Wc++0x-compat", to help with this. The incompatibilities are pretty small but this should turn up anything that will be a problem.

One large incompatibility is that libstdc++'s ABI changes with the move to C++11, so you'll also have to make sure you can deal with that.

Once you know it's safe to move over, just start building in C++11 mode. You can gradually adopt whatever C++11 features seem useful to you as you write new code or change old code. You might want to also consider checking for uses of deprecated functionality, such as the old exception specifications, and replace those with the new stuff.

There's a lot of new stuff so have a look through the standard if you can get it or some documentation online. I find that most of the really interesting stuff I want to use directly is in the library. Unfortunately that seems to be where current implementations still lag the most.

like image 107
bames53 Avatar answered Nov 12 '22 10:11

bames53