Play Rock Hard: C++ Evolving

The Discussion

  • User profile image

    Awesome session; C++ is still evolving. C++0x will be this year, and some of the features were really stunning.

  • User profile image

    Great session.  Definitely some "mind-bending" going on. Smiley

  • User profile image

    I expected more :(

    This info have been repeated several times already in other sessions.

    Please stop repeating old news.

  • User profile image

    Hey Ron,

    I'm sorry to hear that. You're right, I didn't present fundamentally new information in this presentation. My goal was mainly to help get everyone on the same page of modern C++. When I asked the audience how many had used lambda expressions only 3 hands out of 200+ went up. We'll definitely post more new things over the coming few months. Any specific C++0x/C++11 things you want to watch?

  • User profile image

    In C# we have the same concept as C++ as the Using statement. While you can do a finally block we would go with the using approach as the preferred method.

  • User profile image

    Hi Larry,

    You are correct that C# deals with resource management with the "using" statement (similarly to other garbage-collected languages, e.g. the "with" statement in Python). My key point is that this leaves the onus on the consumer of an API to remember to use the construct rather than making the cleanup completely seamless as it is with an RAII class in C++.

  • User profile image

    @Boris:  I don't know about Ron, but I want more coverage of std::thread (§ 30 from the draft standard): common scenarios and code walkthroughs for futures, code walkthroughs of mutual exclusions and conditional variables, thread local storage, (esp.) the strengths and limitations of the thread model chosen, and std::thread's interaction with other standard libraries (like std::atomic [from § 29], the standard containers [from § 23], the standard iterators [from § 24], and the standard algorithms [from § 25] ... if there is any interaction).

    Secondly, from § 8.5.4, I would also like to see more coverage of std::initializer_list and how these initializer lists can be manipulated at compile-time (if at all) ... the same way type_traits manipulates items at compile-time (i.e. template meta-programming).  I would like to enter in easy-to-type info into an initializer list, have a manipulation/optimization of that info happen at compile-time (instead of at run-time in the constructor), and then let the constructor create the object at run-time using this manipulated/optimized info.

    Lastly, from § 2.14.5, I would like to see coverage of raw strings (that whole R"..." thing) and how the delimiters and parentheses work.  Raw strings seem like C# @"..." string ... but with extra stuff ... so I'm wondering what the extra use-cases are.  I'm also wondering if raw strings enable any special use cases with std::regex (from § 28).


    Joshua Burkholder

  • User profile image

    Sorry Burkholder, it would surprise me (in a good way) if a microsoft employee would demonstrate features not yet in a released microsoft product, visual studio 2010 in this case.

    1. How about some usage cases for lambdas and other new C++11 features and also mention how not to use them ex. due to performance loss ?

    2. What things doesn't visual studio 2010 follow in the new revision of standard ex. lambdas 2.1 ?

    3. You could talk about some new stuff that haven't been talked much about yet.

    "When I asked the audience how many had used lambda expressions only 3 hands out of 200+ went up."
    That's interesting i thought those that went to these things actually kept up with the standard development. GCC do have most features implemented already so playing with them wouldn't be a problem.

  • User profile image

    Hey guys,

    I definitely have no problems demonstrating features in the language that are not yet in our compiler. In fact, I debated doing that in this talk since initializer lists and constructor chaining make things quite nice. That said, I often have to balance that with the fact that the audience wants to be able to play with what I show immediately, which drives me towards highlighting the pieces that are already in the product. It's impossible to get all the goodness of C++11 into a 1h talk so there's always going to be a selection process.

    As for your specific requests, Herb Sutter gave a great talk about lambdas in more detail ( that you might like. I do think we can do a better job of where lambdas can be dangerous.

  • User profile image

    "That said, I often have to balance that with the fact that the audience wants to be able to play with what I show immediately,"

    bullshit also a more wiser choice would have been to wait with the talk until later (wait for compilers to catch up)

    Need i say more ?

    So yes, it does exist. GCC have many c++11 featues implemented already. GOOO open source!

    Got any more excuses ?

    So in the next talk i expect you to mention gcc and what it already have for programmers to play with.

    "It's impossible"
    Yes there are many new things but it also depends on how good you are at structuring your talk.
    Less PR talk helps too ;)

  • User profile image

    @Boris:  In order to show more C++0x features without comprimising non-disclosure agreements on future versions of Visual C++, you can use g++ with the flag: -std=c++0x.

    Even though g++ is popular on Unix-based systems like Linux, there is also a popular open source port of g++ for Windows:  MinGW.  MinGW can be found here:

    and here:

    As Ron noted, here is the current state of C++0x development for g++:

    Although g++ is well behind Visual C++ 2010 in C++0x standard library development (for instance, g++ has not fully implemented std::regex ... currently, there are only stubs), g++ does have many C++0x core language features implemented ... and even some that Visual C++ 2010 does not.

    So if MinGW is installed on Windows and we have a main.cpp, then we can just execute the following command line to compile main.cpp into main.exe:

    g++ -o main.exe -std=c++0x -march=native -O3 -Wall -Wextra main.cpp

    and then execute main.exe to run on the local machine.

    Since MinGW currently ports g++ version 4.5.2 ... which implements C++0x raw strings, then main.cpp could contain the following code:

    #include <iostream>
    using namespace std;
    int main () {
        cout << R"("C:\Program Files\")" << endl;
        return 0;
    This code doesn't currently compile in Visual C++ 2010 (because C++0x raw strings aren't yet implemented); however, g++ 4.5.2 has no issues ... so if we execute the following on the command lines:

    g++ -o main.exe -std=c++0x -march=native -O3 -Wall -Wextra main.cpp

    Then main.exe will compile and run ... producing the following output:

    "C:\Program Files\"

    Very Respectfully,
    Joshua Burkholder

  • User profile image

    Indeed. GCC is ahead of our compiler in its language support for C++0x. I apologize if we gave the impression otherwise. I'll definitely be clearer in my next talks on this topic.

Add Your 2 Cents