Why Did Bjarne Stroustrup Create C++?
Bjarne Stroustrup designed C++ to combine the object-oriented structure of Simula with the raw computational speed and hardware efficiency of C. Frustrated by the trade-offs of existing tools while working on large distributed systems during his doctoral research, Stroustrup set out to build a language capable of managing massive software complexity without sacrificing runtime performance. This pursuit led directly to "C with Classes," which eventually evolved into modern C++.
The Academic Catalyst: Simula vs. BCPL
The core problem that sparked C++ arose during Stroustrup's Ph.D. work at the University of Cambridge in the late 1970s. His thesis focused on analyzing distributed computing systems, which required simulating complex interactions across multiple computers connected over local networks.
To model this, Stroustrup initially chose Simula 67. Simula offered classes, inheritance, coroutines, and modular abstraction—features that made organizing the intricate simulation straightforward and maintainable. However, Simula suffered from severe runtime overhead and poor garbage collection efficiency. The program ran too slowly to produce practical results for large-scale simulations.
To finish his research, Stroustrup had to rewrite the simulation in BCPL, a predecessor to C. BCPL delivered the necessary execution speed and low-level control, but managing the architecture of a massive program without abstraction mechanisms proved cumbersome, error-prone, and labor-intensive.
This stark contrast revealed a glaring gap in systems engineering: developers had to choose between high-level structural clarity or low-level operational performance. Stroustrup resolved never again to tackle a complex problem without both.
Bell Labs and the Birth of "C with Classes"
In 1979, Stroustrup joined Bell Laboratories' Computing Science Research Center in Murray Hill, New Jersey. His assignment involved analyzing the UNIX kernel for distributed execution, which once again demanded modeling system-level interactions under strict performance constraints.
Rather than designing an entirely new language from the ground up, Stroustrup chose to extend an existing, widely adopted tool: the C language. C offered significant operational advantages:
- Ubiquity and Portability: C was already deeply integrated into UNIX environments and ran on diverse hardware architectures.
- Direct Hardware Mapping: Operations in C closely corresponded to underlying machine instructions, ensuring maximum execution speed.
- Compatibility: Existing C libraries, tooling, and developer mindshare could be utilized immediately.
Stroustrup developed a preprocessor called Cpre to add Simula-style
features to C, calling the resulting language "C with Classes." This
dialect introduced constructors, destructors, member functions, basic
access control (public and private), and
derived classes.
The Zero-Overhead Principle
As "C with Classes" matured into C++ in the mid-1980s, Stroustrup formalized several foundational design philosophies, chief among them being the Zero-Overhead Principle. This rule dictated two core engineering rules:
- What you don't use, you don't pay for.
- What you do use, you couldn't hand-write any more efficiently by dropping down to raw C or assembly.
This principle guided the implementation of advanced language
features. For example, runtime polymorphism was achieved through virtual
method tables (vtables), which incurred overhead only when
virtual functions were explicitly invoked. Features like compile-time
templates and static type checking delivered expressive abstractions
that resolved during compilation rather than burdening the running
program.
The Lasting Legacy of Stroustrup’s Vision
Stroustrup’s initial motivation—uniting high-level organization with bare-metal efficiency—established C++ as the bedrock language for performance-critical computing. Decades later, fields requiring real-time execution, constrained resources, or massive throughput continue to rely on the exact balance Stroustrup sought to strike. From operating systems and game engines to aerospace control systems and financial trading platforms, C++ remains defined by its founder's refusal to compromise speed for structure.