C++11 Support?

Discussion to talk about software related topics only.
Post Reply
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

C++11 Support?

Post by tod »

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.

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;
   })
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.
dpursell
Posts: 20
Joined: Thu Aug 05, 2010 3:15 pm

Re: C++11 Support?

Post by dpursell »

Resurrecting this thread because I'd like to use C++11 too, so I briefly asked Forrest about it at the developer's conference last week. I don't remember the details, but said he does personally have to do some porting/cross-compiling work on gcc to enable it for use with NetBurners.

He seemed to indicate that it's not an incredibly difficult or time-consuming task, but my impression was that it's not a priority at the moment, which makes sense as I imagine a very small percent of developers would actually use C++11 features. I think he did say that he has a copy of gcc 4.6 ready to port if it does become a priority, which according to http://gcc.gnu.org/projects/cxx0x.html has the majority of C++11 implemented, so maybe if enough people say they'll use the features it could get bumped higher on the priority list.

+1 vote for C++11 here!

-David
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: C++11 Support?

Post by tod »

I was just using C++ 11 with Qt and used the new for syntax for range based for (aka foreach) is simplicity itself, it works with arrays, strings or containers. Here's some actual code for looping over an array and adding each item to a container.

Code: Select all

for (auto item: cmd_array)
{
   cmd_list.append(item.toString());
}
I find it hard to believe any C++ programmer doesn't want to move to C++2011.
maxwellsmuse
Posts: 3
Joined: Wed May 07, 2014 3:13 pm

Re: C++11 Support?

Post by maxwellsmuse »

I'm working with a large company (consultant) developing a system which may use Netburner SB70LC for some hardware control that we need to do.

I strongly prefer C+11 support (all of our other code is being written to the new standard).

Will this be supported soon?

Thanks
Post Reply