C++11 Support?
Posted: Wed Sep 26, 2012 11:23 am
I'm wondering what steps have to happen to have C++11 support. (I'm also wondering if anyone else is interested). A little over a year ago the GNU 4.7 release supported the vast majority of C++11 features. BTW, if you just develop an app for Windows you can add -std=c++11 to the compiler misc. options line and it will compile for the new standard (assuming a recent release of MinGw or Cygwin is installed).
Of course without an m68K cross compiler this does us little good. I've never known where the cross compiler comes from. Does NB Build this? Does FreeScale? It' just idle curiosity but can anyone tell me? Then I assume once we have a 4.7 version of the gcc-m68K chain it has to be tested against and integrated with the NNDK. Seems like that's probably a big job. I was just wondering if there's any movement towards this goal and if NB has a bogey for it (1 year, 5 years never etc.)
A couple of reasons why I'm asking
I'm mostly envious of lambda expressions. Once you program in C# for a while you realize how convenient they are, and writing all those dreaded little functors to use STL algorithms got old a long time ago. However, things like Rvalue references and the move semantics that enables, strikes me as something that would be useful in the embedded world. The new use of auto and the free begin() and end() methods are also pretty appealing.
Given that we are currently using GCC 4.2.1 (June 2007) I'm hoping the bogey is five years or under. The new lambda syntax made it into 4.5 (2010), so maybe three more years for lambdas? I can always dream.
Of course without an m68K cross compiler this does us little good. I've never known where the cross compiler comes from. Does NB Build this? Does FreeScale? It' just idle curiosity but can anyone tell me? Then I assume once we have a 4.7 version of the gcc-m68K chain it has to be tested against and integrated with the NNDK. Seems like that's probably a big job. I was just wondering if there's any movement towards this goal and if NB has a bogey for it (1 year, 5 years never etc.)
A couple of reasons why I'm asking
I'm mostly envious of lambda expressions. Once you program in C# for a while you realize how convenient they are, and writing all those dreaded little functors to use STL algorithms got old a long time ago. However, things like Rvalue references and the move semantics that enables, strikes me as something that would be useful in the embedded world. The new use of auto and the free begin() and end() methods are also pretty appealing.
Code: Select all
//no need for those rather lengthy explict type declarations for iterators (or any type for that matter)
auto iter = MySTLCollection.begin(); //Compiler can infer the type.
//The free functions begin() and end() work on STL containers and things like plain old C arrays.
//So you can write more generic code that handles both, and is less error prone.
for ( auto array_iter = begin(plainOldCArray); array_iter != end(plainOldCArray); ++array_iter)
{
//Can't have an off by one error looping through an array this way.
}
//or even better (where T is type of array)
std::for_each(begin(pocArray), end(pocArray), [&](T item){
//lambda time - can use local vars by ref and array element "item" here;
})