Paul Krill
Editor at Large

Stroustrup: Why the 35-year-old C++ still dominates ‘real’ dev

analysis
Aug 15, 20145 mins
Software Development

C++ inventor details the language's latest changes and assesses the strengths and weaknesses of its competitors

Bjarne Stroustrup designed the C++ language in 1979, and the general-purpose language for systems programming has become a mainstay for developers everywhere, despite competition from Java, JavaScript, Python, Go, and Apple’s newly unveiled Swift.

Now a technologist at Morgan Stanley and a professor at both Columbia University and Texas A&M University, Stroustrup spoke with InfoWorld Editor at Large Paul Krill about C++’s role today and about other happenings in software development, including Google’s Go and Apple’s Swift languages.

InfoWorld: Where do you see the role of C++ today, when you have popular scripting languages like Python and JavaScript along with languages like Java and even Google’s Go? How does C++ manage to survive, thrive, and grow in such a diverse landscape with all these different languages?

Stroustrup: That’s a good question. People have been predicting its demise quite enthusiastically for more than 20 years, but it’s still growing. Basically, nothing that can handle complexity runs as fast as C++. If you go to some embedded areas, if you go to image processing, if you go to some telecom applications, if you go to some financial applications, C++ rules. You don’t see it much if you’re into looking at apps and such, that’s not where you find it. It’s things like Google, Amazon, search engines, where you really need performance, that’s where it is.

InfoWorld: Google’s Go language is getting attention lately. What’s your perspective on Google Go?

Stroustrup: It seems to be one of these languages that can do a few things elegantly. [But languages] focused on doing those things elegantly lose the edge in performance and lose a little bit in generality. But of course, we have to see what happens.

InfoWorld: Some of these new scripting languages are intended for easy consumption by developers. Would you say C++ requires more attention than that?

Stroustrup: Oh, definitely. C++ is designed for fairly hardcore applications, and it’s always been used together with some scripting language or other. When I started, I used C++ for anything that required a real programming language and real performance. Then I used the Unix shell as my scripting language. That was how it [was done], and that’s also the way things are done in most of the cases today. [C++ is for] high performance, high reliability, small footprint, low energy consumption, all of these good things. I’m not saying hobbyists, I’m not saying quick apps. That’s not our domain.

InfoWorld: Apple debuted its Swift language on June 2. Do you think the fact that it has Apple’s backing it means it’s going to be a significant language that developers are going to have to pay attention to?

Stroustrup: I think so. They paid attention to Objective-C, and now Swift is moving into that exact domain again.

InfoWorld: I’m looking at the blurb about an upcoming keynote you’re presenting. It says, “C++ faces two challenges: helping programmers address the most demanding tasks in terms of performance, scale, and dependability. It also must help programmers be productive writing ordinary maintainable code.” What can be done about these issues?

Stroustrup: I’m trying to explain the two things. One is to delve into efficient abstraction, efficient use of hardware, and the other one was simplifying writing new code, and with C++ 11 and C++ 14, there are some new facilities for that.

There’s a new minor edition of the standard coming out this year, which is what we refer to as C++ 14. It’s already shipping from Clang and GCC. The way I describe it is that C++14 is completing the work we did for C++ 11. When you are shipping a big product, which C++ 11 was, there are some things don’t make it in just because you have to ship. And there’s a few things you can’t get right until you have everything put together and try it. And C++ 14 is [offering] things like that that didn’t make it into C++ 11.

Instead of just the lambdas we had in C++ 11, we now have generic lambdas, and the lambdas can capture using move semantics, things like that. These are fairly technical things — function, return, type deduction goes on just like for lambdas. The “constexpr” functions functions — functions that you can do at compile time — can now contain simple For loops. We have variable templates, there’s improvements in memory initialization. There’s user-defined literals.

InfoWorld: What about the issue of security in programming? Is there anything that developers need to do as far as securing their programs? Is C++ a more secure language than others?

Stroustrup: I’m a great fan of hardware to aid security. In terms of programming languages, if you want to write good programs, write your code type-safe. You can do that in C++. Don’t mess around with low-level features all the time. And don’t go to fully general interpreters where you can’t track what is going on. Basically, security is a systems issue.

InfoWorld: Is there anything else you want to say about C++ or anything else in software development these days?

Stroustrup: We should aim for a greater degree of professionalism in software development. There are things in our society that musn’t break, and most of them depend on software. And we need to consider our systems as a whole. Languages and their tool chains are part of it. We need to look into how we educate our developers and how we put emphasis on reliability.

This story, “Stroustrup: Why the 35-year-old C++ still dominates ‘real’ dev,” was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.