We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message
78,721 News Articles

Stroustrup reveals what's new in C++ 11

Latest version of language isn't major overhaul, but offers many small upgrades to appeal to different areas of development

Bjarne Stroustrup first started developing the the C++ language in 1979 at Bell Labs. Back then, it was called "C with Classes," and it was created as part of an experiment in distributed computing. In the 30-plus years since, the language has taken off, becoming one of the most popular programming languages in use today.

Stroustrup, now a professor of computer science at Texas A&M University, talked with InfoWorld editor at large Paul Krill questions about the past, present, and future of C++, which was recently upgraded via the C++ 11 release.

[ Read InfoWorld's recent interviews with developers of the Ruby, Dart, and Kotlin languages. | Subscribe to InfoWorld's Developer World newsletter for the latest happenings in software development. ]

InfoWorld: What was your intent in developing C++?

Stroustrup: To build a general tool for managing the complexity of performance-sensitive applications. My immediate need was to write some simulations and some device-level software for an experiment in distributed computing at Bell Labs. Much of my inspiration came from the use of Simula and BCPL.

InfoWorld: What's the status of the C++ 11 upgrade and what was your role in developing it?

Stroustrup: C++ is specified by its ISO C++ standards committee. I'm a founding member of that committee and active as the chair of the Evolutions Working Group that evaluates proposals for new language features. I also try to help the committee set directions. C++11 became an international standard late last year, and the C++ compiler purveyors are now busy implementing it. Many features and the entire new standard library are already shipping.

InfoWorld: What do you see as the most important features of C++11? Accommodations for multithreading, perhaps?

Stroustrup: Certainly, standard and type-safe support for thread-level and lock-free concurrency is a major improvement on the various non-standard concurrency libraries that have been available for C++ for decades. It will be a boon to multiplatform development. The language feature changes are relatively minor, but there are quite a few of them; which of them are the most helpful will depend on what a programmer is doing.

I like the way move semantics will simplify the way we return large data structures from functions and improve the performance of standard-library types, such as string and vector. People in high-performance areas will appreciate the massive increase in the power of constant expressions (constexpr). Users of the standard library (and some GUI libraries) will probably find lambda expressions the most prominent feature. Everybody will use smaller new features, such as auto (deduce a variables type from its initializer) and the range-for loop, to simplify code.

InfoWorld: What future directions do you anticipate for C++?

Stroustrup: It's a bit early to say. We [the committee] have started to consider proposals for new language features and new standard library components, but nothing has been cast in stone. We need to develop a consensus. We aim for a new standard in five years. That limits how ambitious we can be. If I had to guess, I'd look to improved support for lightweight concurrency, more libraries (something like boost::filesystem), and several minor features. There are study groups for concurrency, modularity, filesystem, and networking.

InfoWorld: How does C++ compare to languages like Java, C#, or the dynamic scripting languages that are proliferating lately?

Stroustrup: I can't do a detailed comparison, but C++ is more flexible (for good and bad) and tends to perform significantly better, assuming competent developers in all languages compared. The other languages tend to have massive standard libraries. For C++, the standard library is relatively small, and a developer is faced with the problem of choosing among a host of commercial and open source libraries when going beyond that.

InfoWorld: At Microsoft's GoingNative 2012 conference recently, you emphasized native programming, saying, "Something has to talk to hardware," and not everything can be a virtual machine. When should a developer opt for native programming, and when should a developer opt for a virtual machine-based language?

Stroustrup: Actually, it was Microsoft that emphasized "native" programming and chose the title, but that's the kind of implementation techniques I've relied on for decades. C++ has significant strengths compared to "virtual machine-based languages" when it comes to building infrastructure. In other words, where performance, reliability, resources, and complexity need to be tightly controlled.

For example, you wouldn't write a JavaScript engine in JavaScript, and you probably wouldn't write a "first to market" simple Web app in C++. You would write the foundations of a Google, an Amazon, a Facebook, or an Amadeus (airline ticketing) in C++, but maybe not the rapidly changing top layers of such systems. C++ comes in strong where power consumption is an issue -- for example, server farms and handheld devices. Naturally, C++ can be competitive even where performance isn't a critical issue, but there the choice will be made more on the availability of libraries and developers than on the languages themselves.

This article, "Stroustrup reveals what's new in C++ 11," was originally published at InfoWorld.com. Follow the latest developments in business technology news and get a digest of the key stories each day in the InfoWorld Daily newsletter. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Read more about application development in InfoWorld's Application Development Channel.

IDG UK Sites

Top 5 Android tips and tricks for smartphones and tablets

IDG UK Sites

How to join Apple's OS X Beta Seed Program: Get OS X Yosemite on your Mac before public release

IDG UK Sites

Why the BBC iPlayer outage was caused by a DDoS attack: Topsy and Tim isn't *that* popular

IDG UK Sites

BBC using Glasgow 2014 Commonwealth Games to trial 4K/UHD, pan-around video, augmented video and...