Exclusive Interview with Bjarne Stroustrup, Inventor of the C++ programming language

A question I ask all programming language inventors is what motivated them to create a new programming language. What problem were you trying to solve when you invented C++?

Stroustrup: I wanted to write a distributed system based on Unix. For that, I needed two things from a programming language: 

  • low-level facilities to deal efficiently with hardware and to write fundamental system code (such as device drivers, memory managers, process schedulers) 
  • high-level facilities for expressing abstractions such as modules and the ways they communicate over a communications infrastructure.

No language at the time could do both well, so I grafter Simula’s class concept into C, getting “C with Classes.” C provided the low-level facilities and Simula’s class concept the basis for the abstraction mechanisms. Constructors and destructors were the key novelties. My decision to treat built-in types and user-defined types (classes) as similarly as possible was important.

Did you believe, when you started off, that it would have the impact it did in the software industry? What effect did this impact have on you as a computer scientist?

Stroustrup: No, I was just trying to solve a problem. Importantly, I decided very early on that I couldn’t predict exactly which problems I would have to solve, so I designed my language to address a large class of problems and assumed that the language would have to evolve based on feedback from use. It turned out that many people had problems for which C++ was a handy tool. Their problems were in the class of problems addressed and inspired improvements.

As a result, I became a tool builder with an interest in reliability, performance, and maintainability. I also had to become a teacher, a speaker, and a technical writer. For example, see my publication list (https://www.stroustrup.com/papers.html) or my video presentations (https://www.stroustrup.com/videos.html).

In what ways was C++ used in ways you had originally not envisioned? How did/do you feel about this?

Stroustrup: Initially, I had seen generic programming as a sub-category of data abstraction and conjectured that it could be done with macros. Well, macros don’t scale so I had to invent templates for more general abstraction. Only with concepts in C++20 is that job reasonably complete. The way Alex Stepanov designed and implemented the STL (the standard-library containers and algorithms using iterators) came as a pleasant surprise and didn’t look anything like what I and most others had expected. On the other hand, I am regularly disappointed seeing people describe and use C++ as if it was some other language. For example, writing code like they would in C or Java, not using C++’s strengths because the key facilities don’t fit their pre-conceived ideas (e.g., templates, classes that are not part of hierarchies, and exceptions).

Side note, as many of our readers are Erlang and Elixir developers: I know Joe Armstrong, Erlang co-inventor, was really keen to meet you and understand the rationale behind C++. He kept on asking friends of his who organized conferences to invite you to be interviewed, and many of us are sad it never happened (He did similar interviews with Alan Kay, Larry Wall, Guido von Rossum). 

Stroustrup: met Joe Armstrong once at a conference, but there was no formal interview, just a nice chat after his talk.

What I find interesting is how .net, Java and Erlang have all evolved into ecosystems of languages focused around a common VM, tooling and libraries. The same did not happen for C++. Any thoughts on why?

C++ was deliberately designed to be just a language among many languages – not a linker, a file system, a distributed operating system, an email system, or whatever. I think that was the right decision at the time, but it has led to weaknesses in areas like build systems, package managers, and static analysis. We can hope such problems can be addressed. The initial decision was influenced by the Unix philosophy of “doing one thing well.” Often, the problems are also a result of the C++ community being so large with so many active organizations. For example, we have dozens of GUIs and graphics systems, some with more users than most programming languages.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: