We scan new podcasts and send you the top 5 insights daily.
Bjarne Stroustrup clarifies that the rivalry between C and C++ is a community fabrication. He and Dennis Ritchie were friends who collaborated, with Ritchie helping design the `const` keyword and even pointing to C++ in his own papers as the language's obvious successor.
The decision to build C++ on C was a pragmatic implementation strategy. Facing over 25 different linkers at Bell Labs, Stroustrup chose to compile C++ to C, using C as a universal low-level target to support all existing toolchains without having to modify them.
An experiment measured developer productivity when switching from C to C++. While C++ compilation took twice as long, its stronger type system caught errors earlier. This resulted in C programmers recompiling twice as often, making the overall time spent compiling roughly equal for both languages.
Stroustrup uses the historical Vasa warship, which sank after a second gun deck was added to its design mid-construction, as a metaphor. It illustrates the danger of adding features to software without ensuring the core architecture can support them, which leads to complexity and instability.
Contrary to the belief that abstraction adds overhead, C++ can achieve "negative overhead." High-level constructs give the compiler more information than raw C code, allowing it to perform aggressive optimizations that result in faster executables.
Stroustrup initially resisted standardizing C++, feeling it was still evolving. However, a coalition of large tech companies insisted, stating their corporate policies prevented reliance on a non-standard language controlled by a single, potentially rival corporation like AT&T.
Stroustrup pushes back on the narrative that C++ is inherently memory-unsafe. He cites studies showing over 90% of buffer overflows occur when developers use legacy C patterns like raw pointers instead of modern C++ features like RAII, vectors, and spans, which are designed to prevent such errors.
Bjarne Stroustrup created C++ because no language offered both low-level hardware access for tasks like managing network drivers and high-level abstraction for modules communicating across computers. He merged C's low-level power with Simula's high-level class concepts to build a distributed OS.
To maintain a single standard, the C++ committee requires "consensus," not a simple majority. The convener makes the final call, weighing the opinions of key implementers (from Google, Apple, Microsoft) more heavily. A feature they all oppose would be rejected even with 95% of the vote.
Bjarne Stroustrup advises against being "too clever." Manual optimizations from the 1990s are often "pessimizations" today because they constrain modern compilers, preventing them from applying more sophisticated optimizations tailored to new CPU architectures, caches, and memory access patterns.
While static typing aids performance, its primary motivation for Stroustrup was reliability in systems without a human operator. Unlike a developer at a desk, a telephone switch or embedded device can't stop and enter a debugger for a runtime type error, making compile-time checks essential for robustness.