Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Herb Sutter: (Not Your Father’s) C++

Download

Right click “Save as…”

Slides (view online)

What makes ISO C++11 "feel like a new language"? What things that we know about past C++ do we need to unlearn? Why is C++ designed the way it is – historically, and in C++11? Finally, what is the difference between managed and native languages anyway, and when is each applicable? This talk gives an overview and motivation of modern C++ and why it's clean, safe, and fast – as clean to code in and as type-safe as any modern language, and more than ever the king of "fast."

Follow the Discussion

  • When is this coming ?

  • LunaLuna

    @Frank: Probably when xmas and haloween fall on the same day! Useless question...

  • CharlesCharles Welcome Change

    @Frank09125: Not a useless question at all. The title/abstract is in flight (this means, well, it hasn't landed yet. As soon as it becomes available, it will be posted here).

    All of these sessions will be recorded and made available on demand no later than a week after the event.

    C

  • LunaLuna

    @Charles: Ok then you are overly generous ;). To me such questions waste useful human resources, like yours for one, who instead of doing useful stuff now have to attend to such questions. I mean it is happening just everywhere all the time, but that shouldn't mean us sticking our heads in the sand... Either way, the time when the presentation is done is prominently denoted, Herb Sutter is talking about C++... The Event is in "some" days and not just about Herb Sutter after all. Who cares about the precise topic? Just wait a few days and you'll know. Its like all those creatures who will later ask "when is the video online"? "Where the heck are the slides"? God dammit, I can't hear this stuff anymore...

  • CharlesCharles Welcome Change

    @Luna: Fair enough.

    C

  • Looking forward to this. It's Herb so you know it'll be cutting edge and based solidly in reality.

  • LunaLuna

    @dot_tom:
    Yes Herb talks are always great. But he always manages to skip one important point. C++ is fast as hell I'll give you that. But even C++11 is no where near the comfort of C#. Syntactic sugar does not cut it. There are pitfalls everywhere and I doubt that all this new candy makes it better, since everything else is still aimed at your own foot. I don't even talk about memory/resource management since C++ is really good at it. But things like object slicing, pointer dangling, and stuff like that really create hard to find and nasty bugs in large code bases...

    Besides that I am not yet convinced that NET languages can't drive at the pace of C++. I blame the JIT compilers! Microsoft had a new one in queue, called "Phoenix". No word about it, sadly, in any recent events. NET does NOT need JIT compilers. Only very few application really need it and those who do can use a little runtime, compiling additional code when required. Reflection and dynamic invocation are no code generation features and can be implemented statically. Same goes for almost any other NET features, except code generation... Serialization also does not require dynamic code generation in theory.

    I admit that C++ has unique language feature to gain that additional bit of performance. But I highly doubt that C# can not run at the same pace most of the time, given a strong static compiler... As long as this question is NOT addressed, not only me but also a whole pile of people just can't be convinced by C++ performance talks. It rather seems like Microsoft is deliberately holding NET performance back. Mono and Java are already ahead performance wise, so there is not much potential in comparing NET and C++ performance...

  • felix9felix9 the cat that walked by itself

    @Luna: Microsoft is still working on that AOT compiler for MSIL.
    https://careers.microsoft.com/jobdetails.aspx?jid=76831

  • LunaLuna

    @felix9: Thanks! This is great news! And also means I can somewhat bury my thesis proposal ;) and think about a new topic...

  • askerasker

    Back to topic: When is this coming? :)

  • LunaLuna

    @asker: Why do you write "back to topic" when you obviously haven't read any of the posts, judging by your question?!

  • Awesome. Thank you for posting this - this is the presentation I've been most keen to catch. I'm very interested to hear what Microsoft is doing to help grow the surface area of Standard library over the next few years. Personally I like to see the C++ standards folks (including Microsoft) get into the habit of regularly publishing 'beta extensions' to the Standard library. If they're so tagged then we can treat them as such while still benefiting early and helping provide real world usage experience to shape them before their officially stamped as Standardised.

     

  • C64C64

    Excellent talk! Thanks for this.

     

  • C64C64

    @Luna:

    C++ is fast as hell I'll give you that. But even C++11 is no where near the comfort of C#. Syntactic sugar does not cut it. There are pitfalls everywhere and I doubt that all this new candy makes it better, since everything else is still aimed at your own foot. I don't even talk about memory/resource management since C++ is really good at it. But things like object slicing, pointer dangling, and stuff like that really create hard to find and nasty bugs in large code bases...

    If you use convenient classes like STL containers, smart pointers, etc. and modern C++ programming style, it is very difficult to have pointer dangling.

    Lots of problems and bugs with C++ and pointers are for old code bases, when C++ was used "like a better C", with raw pointers everywhere, no smart pointers, etc. But in more recent times the story changed.

  • @C64: The big thing I personally got out of last week's event and chats was that Standard C++ now does have a safe subset, but we need a concrete description -- ideally a mode. It has made me think again about doing a scrub of all standard C++ language and library features and marking some as "unsafe" in some way (possibly that allows overloading, such as for vector::op[] overloads for safe and unsafe instead of the current hack of providing op[] and at() which almost nobody uses), then supporting a switch that enables only safe mode. I believe I know how to do that very efficiently now that we have C++11.

    I'll have to look into this more over the summer. I think saying "use this (possibly standardized) switch/mode and your modern C++ code is type- and memory-safe" would be a big deal and an important missing piece to completely answer and dispel this question. The question "what subset of C++ is that exactly and is it a usable subset" is a legitimate question now, and IMO wants a more concrete answer than we have today. I did look at this about four years ago, but Angel we know more now, and (b) C++11 has already added most of the then-missing pieces now.

  • , hsutter wrote

    (...) that Standard C++ now does have a safe subset, but we need a concrete description -- ideally a mode. It has made me think again about doing a scrub of all standard C++ language and library features and marking some as "unsafe" in some way (possibly that allows overloading, such as for vector::op[] overloads for safe and unsafe instead of the current hack of providing op[] and at() which almost nobody uses), then supporting a switch that enables only safe mode. (...)

    (...) I think saying "use this (possibly standardized) switch/mode and your modern C++ code is type- and memory-safe" would be a big deal and an important missing piece to completely answer and dispel this question. (...)

    If this mode incurs any performance cost, people won't use it. If this mode breaks when compiling any 3rd party or "legacy" headers, people won't use it. Look at the mess we already have with managing warnings/warning levels and static analysis annotations ...

    Still, I'm very keen to see what the outcome of such an endeavor could be Smiley

  • , MartinBa wrote

    *snip*

    If this mode incurs any performance cost, people won't use it. If this mode breaks when compiling any 3rd party or "legacy" headers, people won't use it. Look at the mess we already have with managing warnings/warning levels and static analysis annotations ...

    Still, I'm very keen to see what the outcome of such an endeavor could be Smiley

    restrict pure?

  • @Luna:I think to save time would be to answer the question or not answer at all. wasting time would be to give a snide comment.

  • LunaLuna

    @jamesfolk1: no because otherwise people will never learn... In fact they won't anyway but hope dies last!

  • , hsutter wrote

    It has made me think again about doing a scrub of all standard C++ language and library features and marking some as "unsafe" in some way (possibly that allows overloading, such as for vector::op[] overloads for safe and unsafe instead of the current hack of providing op[] and at() which almost nobody uses), then supporting a switch that enables only safe mode. I believe I know how to do that very efficiently now that we have C++11.

    What about this idea.  Have a separate namespace within or beside std, call it safestd.  In there have safe substitutes for various functionality in the standard.  Then you could choose between safe and efficient selectively with a typedef or a `using` statement.

  • Aaron StainbackAceHack AceHack

    @hsutter I'm so excited to hear you talking about a possible await language feature for C++.  And now I just read your comments about a possible safe mode, I'm running out of reasons to choose C# over C++ on many types of projects now. Smiley

  • LunaLuna

    >I'm running out of reasons to choose C# over C++ on many types of projects now.

    First, it will take additional 5 years (at least) until this makes it into the standard and only god knows what happened to NET and C# by then... Also the NET class library is a little more extensive =).

    Second, the "safe" mode was my idea :D... I wanted to build it into Clang together with "pure".

  • LunaLuna

    @bejamin: >Then you could choose between safe and efficient selectively with a typedef or a `using` statement.

    Very bad idea. Especially for templates this could be a hazard. But Herb already mentioned the good solution. Have "restrict()" do the work, just as it is for C++.AMP right now.

  • @bejamin: >Then you could choose between safe and efficient selectively with a typedef or a `using` statement.

    Very bad idea. Especially for templates this could be a hazard. But Herb already mentioned the good solution. Have "restrict()" do the work, just as it is for C++.AMP right now.

    @Luna: Could you please elaborate on why you believe it would be a hazard?

     

  • Ivan SotoIvan Soto

    What's going on? No more destructors? Automatic garbage collection? Virtualized runtime? What? What? What? Can't wait to find out ...

  • evildictaitorevildictait​or Devil's advocate

    Besides that I am not yet convinced that NET languages can't drive at the pace of C++. I blame the JIT compilers!

    It's usually the GC rather than the JIT compilers that cause the slow-down, although even that is pretty small now.

    Microsoft had a new one in queue, called "Phoenix". No word about it, sadly, in any recent events. C++ goes through Phoenix just like your C# does.

    Phoenix is a unification of all of Microsoft's compilers. It's there in VS2011.

    Mono and Java are already ahead performance wise.

    Citation needed.

  • remi blanchetteremi blanchette

    Can we get the slides from somewhere?

  • LunaLuna

    > It's usually the GC rather than the JIT compilers that cause the slow-down, although even that is pretty small now.

    No its not. Quite the contrary. GC's can actually yield performance improvements over native code due to cache locality. The problem with most GCs is that they are not controllable, something that screams for a fix... I am not talking about the compiler itself, but the generated code.

    > Phoenix is a unification of all of Microsoft's compilers. It's there in VS2011.

    Phoesnix originally was meant to be something different. That is a unification of optimization and IL code. So that that all languages are compiled into the same rich IL code (even C++) and then analysis tools built on top would work with all languages, especially the optimizer which could now optimize all language at C++ pace and finally also emit native code or IL code for any language. This is definitely not in VS11, not even close. Microsoft seems to be working at a C++ and C# native compiler but that is not was Phoenix was originally about and also is nothing that we will see in VS11...

    > Citation needed.

    Just try it out... The only bottleneck of Java was the GC, which was noticably slower than NET, but maybe it is improved in Java 7.

  • Uwe DolinskyUwe Dolinsky

    Quote (at around 1 minute and 20 seconds into the talk): "while still retaining 100% backward compatibility".
    That statement is misleading as C++11 is not 100% backward compatible with c++03 or previous versions of C++. For example while standard C++11 compilers won't compile code where auto is used as storage specifier, other new features like reference collapsing or deducing template parameters as types with local linkage change the semantics of some programs. Using this knowledge it is even possible to write programs to detect (purely on the language level) differences between C++11 and earlier versions of C++, see http://stackoverflow.com/questions/6473218/what-differences-if-any-between-c03-and-c0x-can-be-detected-at-run-time

  • +1 if you think Luna is trolling ><

  • SmerdlapSmerdlap

    So are there any studies that show that Java/C# actually give productivity gains over C++? And how much of the gain is simply due to the massive amount of wealth invested in their libraries? It seems Java and C# go out of their way to sabotage the RAII idiom and it seems like a big handicap for the programmer.

    If you are willing to sacrifice the user experience and performance and mobile battery life simply to reduce your labor costs, you must have few customers indeed.

  • CharlesCharles Welcome Change

    Can we get the slides from somewhere?

    Click on the slides link under the inline media player Smiley
    C

  • FernandoFernando

    @Luna:
    I propose you a challenge.
    Choose your favorite language (C#, Java...)

    Make a Matrix type (Generic, obviously. In the sense that Generic Programming means -maximal reusability, same performance-).

    Code it now in C++ (C++11, better).

    Next, compare the code and do performance benchmarks.

    Regards.

  • JonathanJonathan

    Everytime I look into C++, I am reminded how bad the tooling support is. For instance, MSFT has Code Canvas for .NET in VS but not in C++ http://blogs.msdn.com/b/kaelr/archive/2012/04/14/exploring-code-canvas.aspx

    I wish C++ devs would get more "love" from Microsoft (yes, you are doing your best but there is definately a big .NET base at MSFT!)

    jon

  • LunaLuna

    @Fernando: No need, since I already know the answer. But the point I was trying to make is that there is no evidence that this gap could not be closed with good static compilers for those languages... But everybody talks as if it was hardwired or these languages were "born" to be slow.

  • freeflyfreefly

    @Jonathan : I have put an entry in "UserVoice site for Visual C++" saying that the Debugger Canvas should be available for Visual C++ as well. I did that long ago. Nobody seems to be interested except me. Nobody has the time to look at these things and raise voice or let the Visaul C++ team know what you think is a valuable proposition to Visual C++. Everyone are confined to their little world and when a problem hits them, they come out yelling and blame everyone possible.

  • Fernandofpelliccioni Fernando

    @Luna: Do you know the answer? Which is it?
    I am with you, there is no evidence, ..., but there is no evidence of the opposite case.

    I don't know if everyone is talking as if these languages are destined to be slow, the only thing I know is that C++ was born to be fast (zero-overhead)...

    These other languages have some features (or lack of) in which they can not compete with C++. Some of them have impact on performance.

    - Poor value semantics
    - Poor generic programming support
    - Abuse of runtime instrospection as default practice
    - Limited expressiveness (compared obviously with C++), see... http://www.codeproject.com/Articles/5676/Spart-a-parser-generator-framework-100-C
    - Portability (C#)

    I think that the only current evidence, it is reality, see...
    http://www.lextrait.com/Vincent/implementations.html

    On the other hand,I wouldn't think to code a simple web application in C++, where the main requirement is time-to-market (for now).

    Regards,

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.