.NET

Interview with Herb Sutter

The lead architect of the Visual C++ design team discusses implementation of C++11 features, why C99 will never be fully implemented, and the emerging "C++ Renaissance"

Implementation of C++11

AB: In several presentations at Build, you discussed some of the delays in implementing C++ features in Visual C++ 11. This chart, however, shows that very few language features made it into the release. When might we see features lie variadic templates? Is that something we might see between [major] releases of Visual Studio? And when will the features missing in the standard be delivered?

HS: The best I can do is repeat the answer that I've given because we don't preannounce products. So, all I can say is "Yes, we're interested." I've said that variadics are mostly implemented and ready to go into some other vehicle, not Visual C++ 11 or VS 11. But don't assume that means, "Oh, great, they only release every two or three years, so it's going to be two or three years after VS 11." As to what exactly that means: We're definitely looking at options to get that into people's hands. It would be premature of me to say anything more specific right now. Hopefully, in the coming months, we'll have more to say about that.

AB: Well, is there a commitment at Microsoft to implement the entire set of new C++11 features or is it like your answer on C99 where features will be based on your perception of customer demands and customer requests?

HS: Oh, it's clear that the vast majority of features are things our customers want, that we want, that we think are good. C++11 is nothing like C99. Like I said, the C99 project did interesting things that were kind of niche, kind of off the rails, from being a general-purpose focus. That did not happen to C++11. As you know, we were highly conformant this past decade to the previous standard, C++98, except for only one or two things. We were 100% conformant, except mainly for export template, which has always been a hotly debated feature as to whether it's wise and how expensive it is to implement. And we never did because we felt it was too difficult, plus we never became convinced that it gave benefit to users to justify the complexity. I don't know of any such feature in C++11, now that export itself has been removed. Interestingly, C++11 did not deprecate it. Usually, you deprecate a feature. The C++ committee did not deprecate export. They decided to simply remove it, because it was not something that should be in the standard. It was the biggest obstacle I know of for anyone, including us, to producing a fully conforming C++11 compiler.

AB: OK, so the plan is to implement C++11 as fully or almost as fully as you did with C++98?

HS: Yes. We think it's a great standard and we want to implement it. And we look forward to continuing to implement more and more of it.

C++ Renaissance

AB: One of the terms frequently heard at the Build conference was "C++ Renaissance." I'd like to know what it means to you. And what is Microsoft doing differently in how it values C++?

HS: The C++ renaissance has two aspects. One is commenting on C++ resurgence across the industry. And, second, particularly at Microsoft, if you look at the short history of C++, it was really only in the decade that started in the mid-90s that people started getting interested in managed languages. Java came along. Then C# came along. And it was completely appropriate. Those languages are good and useful. They optimize for programmer productivity. And that's exactly the right thing to optimize for, if that's your primary cost. And during that decade we didn't do all that much exciting stuff, especially with user interfaces. We deployed across the industry a bunch of computers with nice windows that had WIMP  windows, icons, menus, and pointers. And we called it good for a decade. And it was only in the last few years that we're starting to see with the iPhone, the touch interface, and augmented reality  Kinect, especially  that we're seeing a whole new kind of user interface. And, of course, all those features now require processing power. We're demanding that the computer do more for us. At the same time, because of the increasing issue of power consumption in mobile devices and in data centers, we're being asked to do more work with less hardware. That's where efficient languages get to be important again, just like they always have been in the history of our industry  except for those 10 years.

AB: Managed languages still have their place, no?

HS: Managed languages are perfectly appropriate where your goal is to optimize programmer productivity above all else, even at the cost of performance…by having always available garbage collection that you can't turn off, always available metadata, always available JIT execution, and a virtual machine…whether you're actually using it or not, you bear the cost. But, you make the programmer so much more productive. Great. That's what you should optimize for if your biggest cost and constraint is programmer productivity. But more and more, at least part or all of your of your application needs to optimize for performance per dollar, or performance per watt, performance per transistor  because you can only put so many of them in a device. And that's why C++ is the preeminent language, because it's the king of performance per dollar. That's why it's making a comeback.

AB: And what does that translate to at Microsoft?

HS: At Microsoft, the same kinds of forces have been at work. As you've seen with Windows 8, it's been public knowledge for the last few weeks, that Windows 8 is built around this nice, OO, class, and exception, interface-based API-based system in WinRT and it's all native code. And the reason for that is performance and efficiency. So we've really seen a resurgence of in C++ at Microsoft. And I think in this particular release  I haven't counted, but I'll bet we shipped twice as many features in this release for native C++ developers, most of whose code can and should be written in standard C++, than in any two previous releases that I can think of. And that's reflective of the investment in C++-based technology.

AB: So, to quote a presenter at Build, this is Microsoft "showing C++ some more love"?

HS: In this release, you're seeing .NET get love, and JavaScript and HTML get love, and C++ get love. And they're all equal on WinRT. It's not just a .NET world like it had been. Actually, even during that decade when managed code was preeminent across the industry, the Windows team was still using primarily native code the whole time. But a lot of the external messaging came from the developer tools division, which was really heavily invested in managed code. That made is sound like all of Microsoft was really doing that, but that was not quite the case.

AB: It's my impression that products like Microsoft Office never got rewritten into .NET. Is that right?

HS: To my knowledge Office is still written in native code. It uses managed code where appropriate. For example, a lot of the server stuff has been written in C#. The desktop stuff, as far as I know, is all native code.

AB: Thank you, Herb. This has been very helpful. It's good to get clarity on C and C++ features as they'll be implemented going forward. I might check back with you in a year to see how Microsoft has delivered on these features.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!