Home Lex Fridman Episode
Lex Fridman · 2019-11-07

Bjarne Stroustrup: C++ | Lex Fridman Podcast #48

C++ creator Bjarne Stroustrup explains how abstraction, types, and zero-overhead design built one of the world's most relied-upon languages.

Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
The guest

Bjarne Stroustrup: Danish computer scientist who created the C++ programming language, which after 40 years still powers critical systems at Google, Facebook, Amazon, and in cars, robots, and rockets.

What this episode covers

Bjarne Stroustrup traces his journey through early languages like Algol 60, Simula, and Fortran, and how Simula's idea of user-defined types inspired C++. He explains the core philosophy of C++: combining high-level abstraction with the efficiency of low-level code via the zero-overhead principle. The conversation covers reliability and safety as system-wide properties, the role of static analysis and simplification in writing good code, and the long ISO standardization process behind C++ 11, 14, 17, and 20. Stroustrup also reflects on templates, concepts, constructors and destructors as the heart of the language, and why he distrusts fuzzy machine-learning approaches for safety-critical engineering.

The guest's own work

BookBy the guest

The Design and Evolution of C++

Bjarne Stroustrup

“there's a in in the book I wrote about that that sign evolution of si+ process a whole bunch of rules like that”— Bjarne Stroustrup

Also referenced (named, not recommended)

BookReferencedISBN verified

The C Programming Language (K&R)

Brian Kernighan and Dennis Ritchie

“if you look at the knr book about si si has arithmetic types and it has integral types it says so in the book”— Bjarne Stroustrup

Big reveals from this episode

  • Stroustrup says he is deliberately telling only the part of programming-language history that lies on his own path, skipping Lisp and McCarthy.
  • He names Bitcoin mining as his least favorite use of C++, saying it uses as much energy as Switzerland and mostly serves criminals.
  • He insists he never said C++ is an object-oriented language; he says it supports OOP plus several other techniques.
  • He explains the zero-overhead principle: an abstraction must not cost more than equivalent hand-written low-level code.
  • Claims C++ matrix multiplication can run faster than Fortran because the right abstraction enables loop fusion and eliminating temporaries.
  • Picks constructors and destructors as the single most beautiful feature of C++, the reason it avoids garbage collection.
  • Says the scariest AI idea is a machine-learning system handing control to a distracted human with seconds to react.
  • Reveals the first C++ standard took eight years and the second took thirteen, longer despite expecting to be faster.

Worth remembering

  • The first program Stroustrup ever wrote, in Algol 60, calculated superellipse shapes and connected points to make star patterns.
  • Assembler and microcode work paid for his Master's degree.
  • He praises a Jason Turner CppCon talk that live-codes Pong on a Motorola 6800 to show C++ shrinking as abstraction increases.
  • Notes it is easier to recognize ugly code than to recognize beauty in code.
  • After Dennis Ritchie, Stroustrup considers himself the major contributor to modern C.
  • He had lunch with Dennis Ritchie most days for 16 years and never had a harsh word with him.
  • The first ANSI C++ standards meeting in late 1989 had about 25 people, a record turnout for such a meeting.
  • The RAII concept came into C++ in 1979, in roughly the second week of his work on 'C with Classes'.
  • He estimates around four and a half million people could pick up an improvement to C++ the next day.
  • His work let him visit telescopes on Mauna Kea, Ford's car factories, and JPL's Mars rovers.