Engineering Philosophy: Bjarne Stroustrup, Abstraction Without Overhead

Bjarne Stroustrup, creator of the C++ programming language

Key Takeaways

  • Abstraction without overhead. Stroustrup built C++ to end the false choice between clear code and bare-metal speed – the expressive version and the hand-tuned version should compile to the same machine code.
  • The zero-overhead principle. “What you don’t use, you don’t pay for; what you do use, you couldn’t hand code any better” is the rule every C++ feature must pass.
  • RAII makes it concrete. Tying a resource’s lifetime to a stack object gives deterministic, exception-safe cleanup with no garbage collector – a pattern Rust later adopted nearly wholesale.
  • Leave no room below. C++ must stay the highest-level language with nothing between it and the silicon except the assembler, or a lower-level language would take its place.

The Principle

“What you don’t use, you don’t pay for. And further: what you do use, you couldn’t hand code any better.” – Bjarne Stroustrup, the zero-overhead principle1

That sentence is the most important one in systems programming, and it carries two promises. The first half says an abstraction must be free at the point of non-use: touch a feature and it costs you something, ignore it and it costs you nothing – not a byte of memory, not a cycle of runtime. The second half is the harder promise: when you do use the abstraction, the compiler must produce machine code at least as good as what a competent programmer would have hand-written for that exact task. A vector that bounds-checks nothing in release mode. A smart pointer that compiles to a bare pointer. An iterator that disappears into a raw loop. The clarity is free.

Most languages force a trade. You get the high-level, expressive version that is slow, or you drop to the low-level, fast version that is unreadable – and the whole craft becomes choosing which pain to accept on which day. Stroustrup’s entire career is a refusal of that trade. He had felt it personally: as a PhD student he loved Simula’s abstractions but found them too slow for real work, and loved BCPL’s speed but found it too low-level to build anything large in.2 C++ exists because he decided you should not have to choose. Efficiency and abstraction were not opposing dials to balance; they were supposed to arrive together, in the same line of code.

That conviction is the same one underneath the argument that performance is not a feature you add but a property you fail to lose. A zero-overhead abstraction is not a fast thing built on top of a slow language. It is a clear thing that the compiler grinds back down to exactly what you would have hand-written, so you never pay for the clarity. “I like my code to be elegant and efficient,” he has said – and the word that matters is the and. He hates having to choose between them.3

Context

Bjarne Stroustrup was born on 30 December 1950 in Aarhus, Denmark.4 He studied mathematics and computer science at Aarhus University, then went to England for a PhD at the Computing Laboratory of the University of Cambridge, which he completed in 1979. His thesis – “Communication and control in distributed computer systems” – was about how to distribute the work of an operating system across a network of computers.4

To study that problem he needed to build a simulator, and he wrote the first version in Simula, the Norwegian language (designed by Ole-Johan Dahl and Kristen Nygaard) that had introduced the world to classes and objects. Stroustrup loved it. Simula’s class abstractions let him organize a large, intricate program the way the problem was organized, not the way the machine was – and the program was a pleasure to write and to change. Then he tried to run it at scale, and the abstractions collapsed under their own cost. The implementation was too slow to be practical. He rewrote the simulator in BCPL, a stripped-down systems language, and got the speed back – but BCPL was so low-level that building anything large in it was misery.2 The whiplash was the formative wound. He had used the expressive language and paid for it in performance, then used the fast language and paid for it in everything else. Neither was acceptable. Both halves should have been possible at once.

He carried that grievance to Bell Labs in New Jersey in 1979, where he again faced a distributed-systems problem: analyzing the traffic of the UNIX kernel across a network. Remembering Cambridge, he set out to add Simula’s organizing power to C – a language already fast and close to the hardware, the systems language of UNIX – without giving up an ounce of C’s speed.45 He called the result “C with Classes.” In 1983 his colleague Rick Mascitti suggested the name C++, the increment operator applied to C itself: the next C, one better, same machine underneath.5

Bjarne Stroustrup speaking

The Work

C with Classes to C++: A Better C That Costs Nothing

The original move (1979–1983) was deliberately modest and exactly right. Take C – already fast, already mapping directly to hardware, already the systems language people trusted – and add the things Simula had taught him to want: classes, better type checking, data abstraction.5 Crucially, he added them as a layer C programmers did not have to pay for. A C program was still a valid C++ program. A struct that used none of the new features compiled to the same bytes it always had. The new power was opt-in, and using it cost only what the equivalent hand-written C would have cost. That is the zero-overhead principle in embryo, present before he had a name for it: do not tax the people who do not use the feature, and do not let the feature generate worse code than they would have written themselves.

He documented and stabilized the language in The C++ Programming Language (1985), the book that made it generally available, and then spent decades defending its core through the design of every later feature.4

The Zero-Overhead Principle

The zero-overhead principle is the load-bearing idea, the rule against which every C++ feature is measured. Stroustrup states it in two parts: “What you don’t use, you don’t pay for (in time or space) and further: What you do use, you couldn’t hand code any better.”1 The first clause is a tax policy – no feature may impose cost on code that does not use it. The second is a quality bar – a feature you do use must compile to code no worse than a careful programmer would have produced by hand for that specific job. Templates, constexpr, move semantics, and the standard library’s containers and algorithms are all designed to honor it; the two famous exceptions, run-time type information and exceptions, are exactly the two features compilers offer switches to turn off, because they bend the rule.6

The payoff is the thing that sounds impossible until you see the assembly: the expressive way and the hand-tuned way produce the same machine code.

Bjarne Stroustrup

That identity – expressive and hand-tuned collapsing into one output – is why the principle is moral as well as technical. It removes the engineer’s standard excuse. If clarity were genuinely expensive, you could justify writing the ugly, fast version “because it has to be fast.” Stroustrup’s bet is that the excuse is usually a lie – that a well-designed abstraction lets you have the readable version and the fast one, because they are the same version. The cost was paid once, by the language designer, so that it would never be paid again by the programmer.

RAII and Deterministic Resources

The principle needed a mechanism for the messiest part of systems programming: resources that must be acquired and then reliably released – memory, files, locks, sockets. Garbage collection answers this by giving up determinism: cleanup happens eventually, on the collector’s schedule, which is intolerable for a lock or a file handle. Stroustrup’s answer, which he named RAII – Resource Acquisition Is Initialization – ties a resource’s lifetime to the lifetime of an object on the stack.7 You acquire the resource in a constructor; you release it in the destructor; and because C++ guarantees that a stack object’s destructor runs the instant it leaves scope – normally or via an exception, in reverse order of construction – the resource is freed exactly when it should be, deterministically, with no collector and no manual free to forget.7

RAII is zero-overhead made concrete. The destructor call is code you would have had to write by hand anyway; the language just guarantees you cannot forget it. You get automatic, exception-safe, deterministic cleanup, and you pay nothing you would not have paid hand-coding the cleanup yourself. It is the C++ pattern that later languages, Rust most prominently, would adopt nearly wholesale.

Standardization and “Leave No Room for a Lower-Level Language”

Stroustrup did not keep C++ as a personal project. He took it to the standards committee – ANSI from 1989, ISO from 1991 – and served on it for decades, chairing the Evolution Working Group, so that C++ would be a stable, vendor-neutral standard rather than one company’s dialect.4 And he gave the committee a constitutional rule, drawn from his design principles in The Design and Evolution of C++: “Leave no room for a lower-level language below C++ (except assembler).”8 The reasoning is exact – if you could write more efficient code in some language between C++ and the bare metal, then that language would become the systems language of choice and C++ would lose its reason to exist.8 To stay viable, C++ must keep C’s direct access to hardware, its control over data layout, and its primitive types that map one-to-one onto the machine.8 Nothing should sit between the abstraction and the silicon except the assembler. The zero-overhead principle, stated as a competitive boundary: be the highest-level language that still leaves nothing on the table.

The Method

The method is one bet – clarity and speed are the same thing if you design the abstraction correctly – enforced as a set of hard rules.

Measure every feature against zero-overhead. No feature may tax code that does not use it, and no feature may generate code worse than hand-written equivalent. This is the gate every C++ addition has had to pass for forty years.16

Trust the programmer, and stay multi-paradigm. C++ supports procedural, object-oriented, generic, and functional styles because Stroustrup refused to decide for you how to organize your problem. The language gives you the tools and assumes you know your domain better than the language designer does.6

Map directly to hardware. Keep C’s one-to-one correspondence between primitive types, data layout, and the machine. The abstraction sits on the metal, not over a runtime that hides it.8

Make cleanup deterministic, not eventual. RAII binds resource lifetime to object lifetime so release happens at a known instant, exception-safe, with no garbage collector and nothing to remember to free.7

Stabilize it in the open. Hand the language to an international standards committee rather than owning it, so that C++ is a durable public standard and no single vendor can fork it.4

Influence Chain

Who Shaped Him

Ole-Johan Dahl and Kristen Nygaard, via Simula. Simula taught Stroustrup what abstraction is for – letting a program be structured the way the problem is structured – and its slowness taught him the other half of the lesson: that abstraction is worthless if you cannot afford to use it. C++ is the attempt to keep Simula’s gift and pay none of its cost. (Direct, formative influence)

BCPL, and the systems-programming culture around C and UNIX. BCPL gave him the contrasting pain – raw speed with no way to organize anything large – and C, the language of UNIX at Bell Labs, gave him the fast, hardware-mapped foundation to build C++ on top of rather than instead of.25 (Direct influence)

Bell Labs. The same institution that produced C and UNIX gave Stroustrup the distributed-systems problem that started “C with Classes” and the research culture that let him spend years getting the language right. (Formative influence)

Who He Shaped

The world’s infrastructure runs on his language. Operating systems, browsers, databases, game engines, compilers, high-frequency trading systems, the Mars rovers’ flight software – the performance-critical core of modern computing is disproportionately C++. Few engineers’ work is this load-bearing.

The zero-cost abstraction movement. Stroustrup’s principle, renamed “zero-cost abstractions,” became an explicit founding goal of Rust, which adopted RAII (as ownership and Drop), deterministic destruction, and the rule that high-level constructs must compile to optimal machine code. Languages like D and Carbon descend from the same lineage. The idea that you should not pay for clarity is now mainstream, and it is his.6

The Throughline

John Carmack wants the inner loop to do the least work physics allows – “the speed of light sucks,” the machine governed by hard limits, every wasted cycle a choice. Stroustrup hands Carmack the tools to write that loop readably: a zero-overhead abstraction is the promise that the clear version and the closest-to-the-metal version are the same machine code, so you never have to pick. Where Barbara Liskov gave abstraction its theory – data abstraction, the contract a type owes its users, the Simula-to-CLU lineage of “you should program against what a thing does, not how it works” – Stroustrup gave that theory a body that costs nothing to run. And where Alan Kay imagined objects as little computers passing messages, a late-bound, runtime conversation, Stroustrup took the opposite road to the same word: his objects are resolved at compile time and dissolve into bare machine code, OOP as a zero-overhead organizing tool rather than a living message bus. Same vocabulary, two philosophies – one optimizing for flexibility, the other for the bill at runtime. (Series bridge)

What I Take From This

The lesson I keep is that “expressive or fast” is almost always a false choice that bad design forces on you. When I find myself writing the ugly version “because it has to be fast,” Stroustrup’s principle is the accusation: that is not a law of computing, it is a failure to find the abstraction that compiles down to the fast thing on its own. The work is to design the clear version so well that the machine produces the optimal code from it – to pay the cost once, in the design, so it is never paid again in every line that uses it. That is the same standard as quality being the only variable: the question is never “can I afford to make this clear?” but “why is my abstraction so leaky that clarity costs anything?”

In the world I build in now – agents, tool loops, AI systems – the temptation is the opposite of zero-overhead: stack a wrapper on a wrapper, eat a model call to paper over a slow path, let every convenient abstraction quietly add latency nobody measures. The Stroustrup move is to demand that the convenient interface compile down to the efficient one – that the clean API and the fast path be the same path, with the cost paid in the design of the harness rather than charged to every call that flows through it. That conviction – that taste is a technical system you can hold a hard rule against, not a vibe you assert – is the throughline from a 1979 simulator that ran too slow to a 2026 agent harness that should not.

FAQ

What is Bjarne Stroustrup’s engineering philosophy?

Stroustrup’s conviction is that you should never have to choose between expressive, high-level code and bare-metal performance. He built C++ on the zero-overhead principle: a language feature must cost nothing when you don’t use it, and when you do use it, it must compile to code no worse than you’d have hand-written for that task.1 He paired this with trusting the programmer (C++ is deliberately multi-paradigm), mapping directly to hardware, deterministic resource management through RAII, and stabilizing the language as an open ISO standard rather than owning it.467

What is the zero-overhead principle?

It is the rule Stroustrup states in two parts: “What you don’t use, you don’t pay for (in time or space) and further: What you do use, you couldn’t hand code any better.”1 The first half means an unused feature imposes no runtime or memory cost; the second means a feature you do use generates code at least as good as a competent programmer would write by hand. It is the gate every C++ feature must pass. The two features that bend it – run-time type information and exceptions – are exactly the two most compilers let you switch off.6 The principle is why a C++ abstraction like a smart pointer or an iterator can compile down to the same machine code as the raw, hand-tuned version.

What is RAII, and why did Stroustrup invent it?

RAII – Resource Acquisition Is Initialization – is the C++ pattern, named by Stroustrup, that ties a resource’s lifetime to the lifetime of a stack object: you acquire the resource in the object’s constructor and release it in its destructor.7 Because C++ guarantees a stack object’s destructor runs the moment it leaves scope – whether the function returns normally or an exception unwinds the stack – resources like memory, files, locks, and sockets are released deterministically, at a known instant, with no garbage collector and nothing to manually free. It gives you automatic, exception-safe cleanup at zero overhead, and Rust later adopted it nearly wholesale as ownership and Drop.7

Why did Stroustrup create C++, and where did it come from?

While writing his Cambridge PhD on distributed systems (completed 1979), Stroustrup built a simulator in Simula and loved its class abstractions but found it too slow at scale; he rewrote it in BCPL, which was fast but too low-level to build anything large in.2 Neither tradeoff was acceptable, so at Bell Labs – facing a problem analyzing the UNIX kernel across a network – he set out to add Simula’s organizing power to C without losing C’s speed. He called it “C with Classes” (1979); his colleague Rick Mascitti suggested the name C++ in 1983.45 In 2018 the National Academy of Engineering awarded him the Charles Stark Draper Prize – engineering’s top U.S. honor, a $500,000 award often called the Nobel Prize of engineering – for his work designing and implementing the C++ programming language.9


Sources


  1. “What is the zero-overhead principle?” Standard C++ Foundation FAQ (isocpp.org), maintained with Stroustrup. “What you don’t use, you don’t pay for (in time or space) and further: What you do use, you couldn’t hand code any better.” See also Bjarne Stroustrup, “C++ – an Invisible Foundation of Everything,” Overload (ACCU), 2021. 

  2. “C++,” Wikipedia. While writing his PhD at Cambridge, Stroustrup used Simula but found it too slow at scale and rewrote his simulator in BCPL; he concluded Simula had features helpful for large software development but was too slow for practical use, while BCPL was fast but too low-level. Primary account: Bjarne Stroustrup, “A History of C++: 1979–1991,” HOPL-II (his own paper). 

  3. Bjarne Stroustrup, “Quotes,” stroustrup.com (his own site). “I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance…” and “Code should [be] elegant and efficient; I hate to have to choose between those.” 

  4. “Bjarne Stroustrup,” Wikipedia. Born 30 December 1950, Aarhus, Denmark; PhD University of Cambridge 1979, thesis “Communication and control in distributed computer systems”; led the Large-scale Programming Research department at Bell Labs; The C++ Programming Language (1985); founding member of the C++ standards committee (ANSI from 1989, ISO from 1991), chaired the Evolution Working Group; later Texas A&M (2002–2014), Morgan Stanley (2014–2022), full professor at Columbia (since 2022). See also Stroustrup’s Bio/FAQ on stroustrup.com. 

  5. Bjarne Stroustrup, “Bjarne Stroustrup’s FAQ,” stroustrup.com. “I wanted to write efficient systems programs in the styles encouraged by Simula67… The specific tasks that caused me to start designing and implementing C++ (initially called ‘C with Classes’) had to do with distributing operating system facilities across a network.” On the 1983 rename by Rick Mascitti: “C++,” Wikipedia. 

  6. “Zero-overhead principle,” cppreference.com. States the principle as defined by Stroustrup and notes the two features that do not follow it – run-time type identification and exceptions – and that compilers commonly include switches to turn them off. On multi-paradigm design and the influence on Rust’s “zero-cost abstractions”: “Zero-overhead principle” and Rust documentation on zero-cost abstractions. 

  7. “Resource acquisition is initialization,” Wikipedia. The term RAII was coined by Stroustrup; the technique was developed for exception-safe resource management in C++ during 1984–1989, primarily by Stroustrup and Andrew Koenig, and introduced in his 1994 book The Design and Evolution of C++. Resource release happens in the destructor; C++ guarantees objects with automatic storage duration are destroyed at the end of the enclosing scope in reverse order of construction, giving deterministic, exception-safe cleanup. 

  8. Bjarne Stroustrup, The Design and Evolution of C++ (1994), design rules, as discussed in “(Re)affirm design principles for future C++ evolution,” ISO C++ committee paper P3466R0. “Leave no room for a lower-level language below C++ (except assembler)” – the reasoning being that if more efficient code could be written in some lower-level language, that language would become the systems language of choice; to remain viable C++ must keep C’s direct hardware access, control over data layout, and primitive types that map one-to-one onto hardware. 

  9. “Bjarne Stroustrup receives Draper Prize, engineering’s top U.S. honor,” Standard C++, 2018: the 2018 Charles Stark Draper Prize, “a $500,000 biannual award… considered the Nobel Prize of engineering,” awarded to Stroustrup “for his work designing and implementing the C++ programming language.” The National Academy of Engineering’s own citation phrases it “for conceptualizing and developing the C++ programming language” (NAE, “Computer Science Pioneer Bjarne Stroustrup to Receive the 2018 Charles Stark Draper Prize for Engineering,” via EurekAlert, 2018). He also received the IET Faraday Medal in 2017 for pioneering C++. 

Artículos relacionados

Engineering Philosophy: Barbara Liskov, The Contract Is the Type

Barbara Liskov made data abstraction a programming primitive: a type is the contract it keeps, and a subtype must honor …

20 min de lectura

Engineering Philosophy: John Carmack, Performance as Moral Craft

John Carmack treats performance as a moral question. Strip to the fast, simple core, understand the problem to its found…

15 min de lectura

From 76 to 100: Achieving a Perfect Lighthouse Score

A FastAPI site went from Lighthouse 76 with 0.493 CLS to perfect 100/100/100/100. The fix: critical CSS extraction, a CS…

10 min de lectura