table of contents

Book review: A Tour of C++

2020-10-03, post № 234

C++, book review, programming, #text, #opinion

Avidly writing C as well as golfing in it for over two years, I decided to venture out further in the realm of C-descendent languages, trying to get a foothold in C++.
However, contrary to many other languages with their own closed communities, style guides, best practices and general higher machine abstraction induced ease of use, C++ is a different language. With a rich history spanning multiple decades, millions of users from varying backgrounds and the necessity of enabling low-level hardware communication influencing its design and ability to be used effectively, it is a daunting task to acquire enough knowledge and experience to successfully write a standards-conforming C++ program which accomplishes a desired task.
Adding to this the plethora of textbooks supposedly correctly presenting their selected corner of the language and with that the immense danger of a poorly written textbook supplying a misleading first impression thus wrecking the fundamental knowledge of the language as well as the path ahead, I hoped for and succeeded in finding a thought-through, holistic and internally consistent as well as surely correct presentation of C++ in A Tour of C++, written by the inventor of and therefore a reasonable authority on C++.

What follows are my thoughts on the book A Tour of C++ [1], having begun to read it after only sporadically adjusting single lines in C++ golfs and having used it to facilitate a five thousand line C++ project simulating a ficticious 32-bit architecture [2].
I am in no way affiliated with either the author Bjarne Stroustrup nor the publisher Pearson (Addison-Wesley) and purchased the book on my own.

Stroustrup wrote three C++ textbooks: Programming: Principles and Practice Using C++ (colloquially ‘the swan book’, referring to its cover), which aims to teach programming using C++, The C++ Programming Language, which aims to cover all of C++, and A Tour of C++ in which a sane and intra-compatible subset of C++ is presented assuming fundamental knowledge of imperative programming. It is the latter that is covered herein.

Multiple textbooks with different target audiences allow Stroustrup to swiftly cover the bare fundamentals, taylored towards C++-specific aspects: the refrain from an enforced garbage collection system and its hardware-conscious design to name two. He goes on to cover custom extensions of the type system by use of implementing a custom std::vector<double> and follows up with the language’s structural facilities. His custom container is used to briefly cover object-oriented hierarchical design — treating object orientation as a language feature rather than its identity — and extends said container using template-driven generality. With a few other necessary features sprinkled into the story of implementing a custom std::vector, the core of C++ is covered by page 105, at the book’s halfway point.
Equally important to an understanding of a language’s core is a broad knowledge of its standard library components — especially in a language like C++ where the standard library itself is standardized and an integral part of the language. Thus, with a slight detour into the land of regular expressions, the standard library’s platform-agnostic I/O model for both character streams and files is shown together with the least specialized standard containers and algorithms which operate upon them. Following algorithms, some miscellaneous yet useful library contents are presented, closing with two terse chapters on numerics and concurrency.
As its final chapter, A Tour of C++ offers some historic perspectives to both the origins from C with classes to the arduous path of becoming the standardized, modern and capable language C++ is today.

Throughout the book, soon to be expected facilities of the C++20 standard as well as ones to hopefully arrive in C++23 or beyond are mentioned and properly framed inside the current C++ landscape. Stroustrup does not hesitate to call out certain iffy historic remnants but puts them in an adequate context to provide a holistic tour of C++, as the title promises.

A Tour of C++ offered an enjoying read; antithetical to the technical nature of the topic at hand, a collected and concise writing style paired with playful aspects such as chapter-opening quotes and occasional tongue-in-cheek remarks about aspects of C++ or other languages [3] help the book not to become a stale checklist of features, motivating a thorough read. End-of-chapter advice and intra-document references help to form a tightly interconnected understanding of the primary pillars of C++ design.
At times, Stroustrup’s syntax of choice can at times seem quaint, being K&R-inspired as well as whitespace-meager, yet this style is used consistently throughout the book and not too far off of what is seen ‘out in the wild’. After some initial C-induced C++ syntax hesitance, I was able to accomodate — devising my own C++ syntax flavor and successfully realizing my ficticious architecture simulation project. [4]


  1. Stroustrup, Bjarne: A Tour of C++, second edition, third printing. Boston: Person (Addison-Wesley), March 2019.
  2. See https://github.com/jfrech/joy-assembler.
  3. Some of my favourite lines:
    • p. 5: “C++ offers a small zoo of fundamental types, but since I’m not a zoologist, I will not list them all.”
    • p. 40: “That’s pretty crude and inflexible, but often sufficient.”
    • p. 73: “My ideal is not to create any garbage, thus eliminating the need for a garbage collector: Do not litter!”
    • p. 88: “For reasons lost in standards committee politics, this use of auto is not currently allowed for function arguments.”
    • p. 208: “C++ is not the work of a faceless, anonymous committee or of a supposedly omnipotent ‘dictator for life’; it is the work of many dedicated, experienced, hard-working individuals.”
  4. See https://github.com/jfrech/joy-assembler.