The designer of C++ recounts its development, dissecting the decisions made in the creation of the language to present a case study in real object-oriented development for the working programmer. In doing so, he presents his views on programming and design in a concrete and useful way. Topics include a prehistory of C++, C with classes, C++ language design rules, standardization, libraries, memory management, multiple inheritance, casting, templates, and exception handling. Annotation copyright Book News, Inc. Portland, Or.
As someone who is not a fan of C++, it was interesting to see how the heck C++ ended up the way it is.
I was aware that prior to C++, Stroustrup created a predecessor called C With Classes. But what I was surprised to learn was that this language did not have virtual functions... making me seriously wonder what the heck the point was. Just to be able to write object.function() instead of function(object) ?
At each step, the decisions made seem pretty reasonable. And yet (IMO), the end result is a mess. I think the constraints on the design (particularly the need for source compatibility with C; also the lack of garbage collection, though that was necessary) were just too much.
Sadly, I don't think there's any real alternative to C++, even today, in its area. A language that lets you be close to the hardware while still giving you some abstractions. Maybe Objective C for some people. Although fewer programs need to be close to the hardware, and that's good.
It's also crazy to realize there was a time when a new general purpose language could ship without even fundamental features like, say, a collections library, and still go on to be so widely used.
It's an excellent book for anybody interested in C++ language design. It clearly shows the logic behind many choices that went into the creation of C++, delving into details such as selecting names for new keywords and the rationale behind the final decisions. If you use C++ daily and hate the little quirks that seem to lurk around every language construct, you will find it an enlightening read. Apparently, a lot of things that seem out of place are there, because, at the time of their creation, they were the only possible solutions, which didn't break everything. I also think anybody who teaches C++ and takes it seriously should once read this book, as it will equip the reader with insights necessary to answer even the most tricky questions. For instance, knowing the reason behind introducing references into the language makes it easier to explain their existence and justify the restrictions put on them. All in all, a great book.
This is a nice short book for C developers that want to understand how higher-level C++ abstractions map to C and the preprocessor. Given that this predates “modern C++” and the standard template library, it focuses on the basics needed to create your own types. It discusses the object model and the this pointer and how it evolved from “C with Classes” up through C++ 2.0. It introduces the fundamentals of virtual functions and how this is implemented with vptrs and vtables. It covers how this became more complex with multiple inheritance. It touches on operator overloading, templates, and namespaces, which are the foundational pieces that enable all the fancy new Python-like syntax of “modern C++.” Most recent C++ books hide C and the preprocessor stuff and instead focus on the new fancy Python-like syntax. If you are instead a C dev and are interested in C++ internals and what is happening when you call into a C++ dependency via C bindings or are porting an algorithm from C++ to C, skip the new books and check this book out.
Important for anyone who really wants to grok C++, even now. The greatest insight I got from this book is that the primary motivation guiding Bjarne and the Evolution Working Group is that user-defined types should be every bit as powerful and expressive as built-in types, not second-class citizens as they are in most languages. This principle is evident in later languages like Rust, even if their designers never explicitly state it.
If you don’t already know C++, read A Tour of C++ before D&E.
A bit out of date (it was published even before the first standard was complete), but nonetheless a very insightful book useful for users of one of the world's most popular programming languages. As always, the WHY is critical for understanding software, and knowing why language features were added and why they were added the way they were is helpful in navigating code bases and understanding the deluge of new language features in the recent standards.
Es interesante ver las restricciones y decisiones que llevaron a C++ a ser el (extraño) lenguaje que es hoy. Stroustrup narra muy bien las circunstancias que pasó diseñándolo, y a veces es incluso divertido de leer. A mí me ofreció mucha perspectiva.