Interview with Herb Sutter

By AndrewBinstock, October 12, 2011

0Comments

Thelead architect of the Visual C++ design team discussesimplementation of C++11 features, why C99 will never be fullyimplemented, and the emerging "C++ Renaissance"

AB: Many folks know you as a C++ specialistwho wrote many articles for Dr.Dobb's about parallel data structures. Whatexactly are you doing at Microsoft?

HS: My title right now at Microsoft isPartner Architect on Windows C++. And I am interested in nativetechnologies, and I lead the Visual C++ language and library designteam, and I work on the compiler front end.

AB: How big a team is that?

HS: We're always going throughreorganizations and there's one going on right now, so I can't giveyou a specific number.

AB: Are we talking below 20 or do you havea lot of engineers working on the compiler and the library?

HS: Well, it's a very broad product.Between developers, testers, and people writing the specs, thelanguage, the libraries, the Windows-specific stuff, some of theMFC libraries...I mean, there's a lot of different pieces and someof them are run by different teams. For example, we ship theParallel Patterns library and that's been built by a differentteam, the Parallel Computing Platform team. So, when you look atthe whole Visual C++ product, there are a lot of different peopleand teams.

C99

AB: C99 has been around more than a decadeand still lacks many features that Microsoft has not implemented.It doesn't look like the remaining missing features are going to beimplemented anytime soon. What is Microsoft's thinking on C99?

HS: C99 conformance is not something ourcustomers have largely asked us for. Yes, there's going to be avocal minority or vocal set of people asking for any particularfeature. But we prioritize what our customers are asking for andneed. Now, that is not to say that C99 is uninteresting stuff. Weactually do implement many of the features of C99. As we prioritizethe features for each release we look at what to add. Likethe restrict qualifier,which we have with the double underscore version in the compileralready. The C99 standard is interesting because it was created ata time when a lot of people on the previous committee (C89— Ed.) went away and did other things. Andit was a smaller group that came over who were interested in aspecial-purpose area, and so it ended up having a lot of thingsthat were not of general-purpose interest. And in fact, when thecurrent revision of C, which is being revised right now, was begunseveral years ago, one of the questions was "Should we roll back orundo some of the revisions we made in C99?" because theoverreaching in C99 was recognized. It remains to be seen whetheranything will be removed. I don't think any features are likely tobe removed. But that the question is asked at all shows thatthere's stuff in there that doesn't really matter to a lot ofpeople.

AB: What about the library?

HS: That's actually related to C++conformance because C++11 incorporates large parts of the C99standard, especially the preprocessor and standard library. Inparticular, the C++11 implementation incorporates the entire C99standard library, which we are now shipping in this release ofVisual C++ as part of the standard library. That includes C99conformance, because it got integrated into C++. And also C++11adopted all of the preprocessor extensions that were in C99.

AB: So Visual Studio .NET 2011 has a full,compliant C99 preprocessor?

HS: No, not the preprocessor, becausethat's a compiler feature. I was thinking that we have a complete,compliant C++11 standard library with workarounds for languagefeatures we have not implemented yet, like variadic templates. So,the user can use the library in all the usual ways. We'll implementit differently when those language features are available. The C99standard library is in the C++11 standard library.

AB: Is that the standard library that waswritten by Dinkumware?

HS: We do get it from Dinkumware, but we'vedone a lot of work on it besides. A lot of work in customizing itspecifically to work well on Windows and we contribute changesback. So, it's not just dropping in what Dinkumware had. Dinkumwarehas a great library and a great source code base, but you'd want usto do the things we've been doing for a better experience underVisual C++.

C as a Subset of C++

AB: One gets the feeling that C99 is viewedinternally at Microsoft as just a subset of C++, rather than itsown language. Is that a fair assessment?

HS: That is a burning question…in theentire industry. Nobody has a good answer to that. Or rather,nobody has a single answer to that. So as the C and C++ committeeswho own the standard progress their work, there is a big overlapbetween the committee memberships. You'll find many people who goto both meetings. Companies are represented at both meetings. Andthere's a lot of effort to harmonize. But there are things that Cdid that are different from the ways C++ did them. And C++ doesthings that extend what C does. They try to converge, but it's notcompletely true that C++ is a superset of C. It's mostly true.

AB: Agreed.

HS:There's thequestion of should it be or should they go their own way, which isfrequently debated (but so far they're very close), but there'sactive discussion on whether that should be a pure subsetrelationship. Having said that, a lot of the work we've done onC++11 standard, especially as it relates to concurrency and atomics— threading, mutexes, and memory models — has been pretty muchwholesale adopted by C. And so things do flow back the otherway.

AB: What other differences prevent C++ frombeing a superset?

HS: C++11 did not pick up many of thelanguage extensions of C99. They were considered; they were lookedat; and people felt this was not important or necessary for C++.Like when you talk about the language extensions likethe restrict keyword in C99— and this is not a question of whether they were good or not, asthere are benefits to the keyword and we have itas __restrict in ourcompiler. But the C++ committee did not feel that that wassomething they were interested in adopting into the standard. SoC++ is not superset of C99. It is a superset of C89 and thenon-language parts of C99, largely.

 

Implementation of C++11

AB: In several presentations at Build, youdiscussed some of the delays in implementing C++ features in VisualC++ 11. Thischart, however, shows that very few language features made itinto the release. When might we see features lie variadictemplates? Is that something we might see between [major] releasesof Visual Studio? And when will the features missing in thestandard be delivered?

HS: The best I can do is repeat the answerthat I've given because we don't preannounce products. So, all Ican say is "Yes, we're interested." I've said that variadics aremostly implemented and ready to go into some other vehicle, notVisual 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 twoor three years after VS 11." As to what exactly that means: We'redefinitely looking at options to get that into people's hands. Itwould be premature of me to say anything more specific right now.Hopefully, in the coming months, we'll have more to say aboutthat.

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

HS: Oh,it's clear that the vastmajority of features are things our customers want, that we want,that we think are good. C++11 is nothing like C99. Like I said, theC99 project did interesting things that were kind of niche, kind ofoff the rails, from being a general-purpose focus. That did nothappen to C++11. As you know, we were highly conformant this pastdecade to the previous standard, C++98, except for only one or twothings. We were 100% conformant, except mainlyfor export template, whichhas always been a hotly debated feature as to whether it's wise andhow expensive it is to implement. And we never did because we feltit was too difficult, plus we never became convinced that it gavebenefit to users to justify the complexity. I don't know of anysuch feature in C++11, now that export itself has beenremoved. Interestingly, C++11 did not deprecate it. Usually, youdeprecate a feature. The C++ committee did notdeprecate export. They decided to simply removeit, because it was not something that should be in the standard. Itwas the biggest obstacle I know of for anyone, including us, toproducing a fully conforming C++11 compiler.

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

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

C++ Renaissance

AB: One of the terms frequently heard atthe Build conference was "C++ Renaissance." I'd like to know whatit means to you. And what is Microsoft doing differently in how itvalues 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 historyof C++, it was really only in the decade that started in themid-90s that people started getting interested in managedlanguages. Java came along. Then C# came along. And it wascompletely appropriate. Those languages are good and useful. Theyoptimize for programmer productivity. And that's exactly the rightthing to optimize for, if that's your primary cost. And during thatdecade we didn't do all that much exciting stuff, especially withuser interfaces. We deployed across the industry a bunch ofcomputers with nice windows that had WIMP — windows, icons, menus,and pointers. And we called it good for a decade. And it was onlyin 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, ofcourse, all those features now require processing power. We'redemanding that the computer do more for us. At the same time,because of the increasing issue of power consumption in mobiledevices and in data centers, we're being asked to do more work withless hardware. That's where efficient languages get to be importantagain, just like they always have been in the history of ourindustry — except for those 10 years.

AB: Managed languages still have theirplace, no?

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

AB: And what does that translate to atMicrosoft?

HS: At Microsoft, the same kinds of forceshave been at work. As you've seen with Windows 8, it's been publicknowledge for the last few weeks, that Windows 8 is built aroundthis nice, OO, class, and exception, interface-based API-basedsystem in WinRT and it's all native code. And the reason for thatis performance and efficiency. So we've really seen a resurgence ofin C++ at Microsoft. And I think in this particular release — Ihaven't counted, but I'll bet we shipped twice as many features inthis release for native C++ developers, most of whose code can andshould be written in standard C++, than in any two previousreleases that I can think of. And that's reflective of theinvestment in C++-based technology.

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

HS: In this release, you're seeing .NET getlove, and JavaScript and HTML get love, and C++ get love. Andthey're all equal on WinRT. It's not just a .NET world like it hadbeen. Actually, even during that decade when managed code waspreeminent across the industry, the Windows team was still usingprimarily native code the whole time. But a lot of the externalmessaging came from the developer tools division, which was reallyheavily invested in managed code. That made is sound like all ofMicrosoft was really doing that, but that was not quite thecase.

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

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

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

HS: Very well.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值