.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"

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

HS: My title right now at Microsoft is Partner Architect on Windows C++. And I am interested in native technologies, and I lead the Visual C++ language and library design team, and I work on the compiler front end.

AB: How big a team is that?

HS: We're always going through reorganizations and there's one going on right now, so I can't give you a specific number.

AB: Are we talking below 20 or do you have a 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, the language, the libraries, the Windows-specific stuff, some of the MFC libraries...I mean, there's a lot of different pieces and some of them are run by different teams. For example, we ship the Parallel Patterns library and that's been built by a different team, the Parallel Computing Platform team. So, when you look at the whole Visual C++ product, there are a lot of different people and teams.

C99

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

HS: C99 conformance is not something our customers have largely asked us for. Yes, there's going to be a vocal minority or vocal set of people asking for any particular feature. But we prioritize what our customers are asking for and need. Now, that is not to say that C99 is uninteresting stuff. We actually do implement many of the features of C99. As we prioritize the features for each release we look at what to add. Like the restrict qualifier, which we have with the double underscore version in the compiler already. The C99 standard is interesting because it was created at a time when a lot of people on the previous committee (C89  Ed.) went away and did other things. And it was a smaller group that came over who were interested in a special-purpose area, and so it ended up having a lot of things that were not of general-purpose interest. And in fact, when the current revision of C, which is being revised right now, was begun several years ago, one of the questions was "Should we roll back or undo some of the revisions we made in C99?" because the overreaching in C99 was recognized. It remains to be seen whether anything will be removed. I don't think any features are likely to be removed. But that the question is asked at all shows that there's stuff in there that doesn't really matter to a lot of people.

AB: What about the library?

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

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

AB: Is that the standard library that was written by Dinkumware?

HS: We do get it from Dinkumware, but we've done a lot of work on it besides. A lot of work in customizing it specifically to work well on Windows and we contribute changes back. So, it's not just dropping in what Dinkumware had. Dinkumware has a great library and a great source code base, but you'd want us to do the things we've been doing for a better experience under Visual C++.

C as a Subset of C++

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

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

AB: Agreed.

HS:There's the question of should it be or should they go their own way, which is frequently debated (but so far they're very close), but there's active discussion on whether that should be a pure subset relationship. Having said that, a lot of the work we've done on C++11 standard, especially as it relates to concurrency and atomics  threading, mutexes, and memory models  has been pretty much wholesale adopted by C. And so things do flow back the other way.

AB: What other differences prevent C++ from being a superset?

HS: C++11 did not pick up many of the language extensions of C99. They were considered; they were looked at; and people felt this was not important or necessary for C++. Like when you talk about the language extensions like the restrict keyword in C99  and this is not a question of whether they were good or not, as there are benefits to the keyword and we have it as __restrict in our compiler. But the C++ committee did not feel that that was something they were interested in adopting into the standard. So C++ is not superset of C99. It is a superset of C89 and the non-language parts of C99, largely.

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!