Bjarne Stroustrup and Herb Sutter on the Future of C++: Part 1: Video Podcast Transcript
Bjarne Stroustrup and Herb Sutter on the Future of C++: Part 1 (video transcription)
Welcome to OnSoftware—conversations with thought leaders in software development. In this session, Ted Neward, Bjarne Stroustrup, and Herb Sutter discuss the forthcoming features in C++0x. Learn about Bjarne and Herb's favorite new features.
Ted Neward: So, gentleman, a year [after our first set of conversations], we're doing this again.
Bjarne Stroustrup: Yeah, hello.
Herb Sutter: Here we are.
Ted: For those who are tuning in fresh, why don't you give us a little bit of background—who you are and what you do?
Bjarne: Well, I guess I'll do myself, as opposed to Herb. Bjarne Stroustrup, I'm here because I designed and implemented C++.
Ted: Wrote a book with that same title, too, as I recall.
Bjarne: Wrote a book or three with the same title, yes. I'm now a professor in Texas, and still work with C++—uses of it, teaching of it, programming it. Looking into a lot of industrial applications, things like that, just having a lot of interesting stuff going on.
Ted: You're still a part of the C++ committee, right?
Bjarne: Oh, yes. I mean, we're here together [gestures at Sutter and himself], I think, because we came from the standards committee meeting last week. And, well, standards work is not exactly fun—
Bjarne: But it's important, and this is one of the ways you can get useful things out to people numbering millions and lasting for decades. So it's important work, and it reflects interesting work.
Ted: We'll get to that, I'm sure.
Herb: Who am I? And what am I doing here?
Herb: I run that standards committee, somehow they managed to let me do that, which mostly means saying when we're going to meet. We were just there [gestures at Stroustrup] and had a nice meeting in Washington State. And voted in Lambda functions (well, that's one of the things we did) into the C++0x working draft. We'll talk more about those things later.
Ted: We'll get to that later, too, yeah.
Herb: Yeah, so that's kind of nice, we're making progress. So here at SD, we're talking about C++. I've been doing lot of concurrency work lately with multicore and everything happening, "free lunch" being over—well, yes, except we just need to line up at a new free lunch, but where is that trough and how do we find it? That's where most of my work is these days, both at Microsoft and also at my independent work, as my professional life is sort of in both of those areas.
Ted: Okay, alright. So, since you guys talked about the standards that you're working on—C++ working draft, V.next, do we have an estimate on when it's going to be not a working draft, but a public final or final draft?
Bjarne: Current schedule is, I think, October this year. And we have one more meeting; we're all going to sunny France, have a wonderful time in a windowless room, for a week on the Riviera.
Ted: You know, that sounded good until you said "windowless room."
Herb: It's always a windowless room.
Bjarne: We had a whole week, 12-hour days, Hawaii, on the beach—in a windowless room. I mean, some people are just gluttons for punishment.
Ted: Wow. Well, how many of the members brought their wives with them, just to try to, like, earn some marriage points? Because I could see that.
Bjarne: Hawaii? Only a handful, because they knew it was—I mean, these are the late meetings, they're difficult. A couple of years ago, it was almost half, but now the work is harder and the free time is less free.
Ted: Okay, alright.
Herb: Especially since we want, at our next meeting in France, to vote the last major features into the working draft and then give it one meeting to sit. Then, in September, when we meet, hopefully (if we meet the schedule) vote out a complete draft for public review and then just do edits and minor fixes for the next year before we finally ship it. We'll see if we make it. It's looking good, we hope that we will, but we're getting close to knowing the good shape of C++0x and what exactly to expect.
Bjarne: So, feature complete, June; draft for public review, October; all kinds of official steps sometime next year. So, we hope in C++0x that "x" will still be decimal—
Bjarne: But we will get the work done by then. Whether the ISO process can grind its way with official nation votes and such....
Ted: But it'll be at a point where, presumably, compilers would be able to support C++0x by 2009?
Herb: Well, that depends. If you're talking about a complete implementation, that always takes a little longer, because some compilers implement some features, and others in the next release. But several compilers have already implemented parts of C++0x—even though the standard has not sailed yet. But those parts are considered fairly stable, so some vendors have done that already. So, there are several parts that you can get already in implementations.
Ted: So, since we're sort of dancing around the subject, C++0x contains—you mentioned Lambdas; what else is there? Because that, you said, just voted in. So what bits are in C++0x that have been there for a while now?
Bjarne: This is really new—that was Saturday, Lambdas.
Herb: And today is Tuesday.
Ted: This is hot news! We're gonna to have to rush to press with this one.
Bjarne: And we've done a lot of work on the foundations for concurrency: machine model, a little bit of language primitives necessary, atomics, and the thread—standard threads, on which you can build different higher-level concurrency models.
Ted: So we're getting a standard thread model in the language?
Herb: In the library.
Ted: In the library.
Herb: Memory-model–defining language semantics; but the rest, it turned out, could largely be built as libraries, using the other C++ power features.
Bjarne: If you have the right primitives, you can build just about anything as libraries. If you don't have the right primitives, it's well known to be impossible.
Herb: So the primitives here, I mentioned memory model, the other one is atomic operations. Java-style volatile—the same kind of thing, something you can use atomically for lock-free programming, or to implement locks and threads on top.
Ted: Since you brought up Java, how much—
Herb: You just clued in on the J-word!
Ted: Well, you know—you gotta jump on these! [Laughs.] You offer me these, you know, holes—ever so tiny.
Ted: Well, obviously, there was a lot of work that went on in Java 5 with the java.util.concurrent package; Doug Lea was a part of that, and William Pugh, who originally pointed out the flaws in the Java memory model. So will we see library support in the same sense that we see java.util.concurrent? We have atomic Boolean and atomic long classes, we have reader-writer lock classes, we have executor thread pool service, and stuff like that? Or do we get atomic as a template? Give me an idea of how it looks.
Herb: There are great similarities with what Java did in 5 and 6, and of course Java 7 is working now and adding the fork/join and other models. This is an evolutionary process that all of us are evolving on. We'll get largely what Java has (think of it in terms of the facilities). Memory model is state-of-the-art memory model, on par with anything, and that all the hardware vendors are able to support—and operating system and compiler vendors.
Ted: I suppose that would be important, that the hardware vendors could actually support it.
Herb: Yes, I have more appreciation for Henry Kissinger of ages past, doing shuttle diplomacy among five major hardware vendors (that I won't name) for about six months, to make sure things worked.
Ted: We could probably figure out who two or three of them are. [Laughs.]
Bjarne: We need a sort of a contract between the hardware architects and the compiler writers, because C++ is still very close to the hardware. And it took them some time to figure out what that contract was going to be, and what could be delivered.
Ted: But that's all done now.
Bjarne: It's done.
Ted: Good. So I don't have to worry about it—even better. So, what else is there?
Herb: Threads, mutexes, same kinds of things. Now, some of the concurrency libraries are in C++0x, the next standard itself; and others will be coming shortly thereafter, as sort of an add-on pack, a second batch of standard library extensions. We already delivered one of those several years ago, which is now in the standard.
Ted: That was the TR1 [C++ Technical Report 1], right?
Herb: TR1, which is now largely in the standard. And now TR2 includes things like thread pools and reader-writer locks, probably, and that's the intent for what we have planned to add shortly after C++0x.
Ted: Okay. Any core language changes?
Bjarne: Yeah, most of them are focused on better support for generic programming because it's such a runaway success with C++ 98, but it's creaking in places. So we get concepts, which is a very flexible mechanism for type-checking of template documents, and things like that. We're going to get automatics, which is basically a way of declaring variables so that they get the type of their initializer, saving a lot of writing. We're going to get some aliasing mechanisms for types (would be template typedefs in the old term). Lambdas fit in there. We're going to get a new FOR loop that will allow easier traversal of containers. All loaded based on concepts. There's a whole package of features designed to work together to make it easier to write good generic code, have it perform as well as we're used to, get better error messages if you mess up, and overall write much less to get the results.
Ted: Hmm. Okay.
Herb: Have you ever compiled templates and seen template error messages?
Ted: [Groans.] Oh yes.
Bjarne: Spectacularly bad.
Herb: Templates work great, but the error messages are, shall we say, sometimes inscrutable.
Ted: I can remember, literally, watching, scrolling through it. [Gestures to indicate a long screen.] I can't remember if it was a Borland or Visual error window—it was really War and Peace.
Bjarne: It's horrible.
Herb: However, the most important thing to know about concepts is that you can say what you mean, so those template error messages should be a thing of the past.
Ted: I'll hold you to that! We'll check in next year and see.
Herb: We're showing live examples this week.
Bjarne: You can check it now. It works.
Ted: Check it now using...?
Herb: ConceptGCC is a prototype implementation that some of the standards committee people have done, that shows how it works—and you can Google for that.
Herb: ConceptGCC, all one word.
Ted: ConceptGCC, okay. I'll hold you to that.
For more information, visit onpodcastweekly.com and subscribe to all our podcasts. Brought to you by the publishing imprints and information portal of Pearson Education.