REVIEW - A Tour of C++ - Second Edition


Title:

A Tour of C++

Second Edition

Author:

Bjarne Stroustrup

Publisher:

Addison-Wesley Professional (2018)

Pages:

256pp

Reviewer:

Ian Bruntlett

Reviewed:

September 2020

Rating:

★★★★★


Highly recommended

The Preface of this book states that it should be treated like a sightseeing tour of a city – but of C++ – after which the language can be explored in more detail.

The first chapter deals with the basics – an overview of the fundamentals of C++ (the notation of C++, its model of memory and of computation) and the basic mechanisms for organising code into a program (procedural programming). The more advanced topics are dealt with in later chapters. There are a few example programs that the reader could type in. The rest are fragments. This is a pity but if you want examples to type in, there are other books that provide them. The next chapter deals with ‘User-Defined Types’ – structs/classes, unions (but prefer std::variant) and enum classes. The next chapter, ‘Modularity’, covers how C++ programs can be developed from individually developed parts – from functions through to class hierarchies and templates and logical modularity (namespaces). Exceptions and other error handling alternatives are covered, including contracts (sadly dropped from C++20) and static assertions.

A huge chunk of the C++ Language is covered by chapters 4 through to 7 and I will attempt to do them justice. Chapter 4, ‘Classes’, illustrates different uses of the class mechanism – concrete types, resource handles, abstract types, class hierarchies... with good examples. It left some details unanswered, though – I presume that the details are to be found in the author’s other books (The C++ Programming Language, 4th Edition, published by Addison Wesley in 2013), the C++ standard or www.cppreference.com. The next chapter deals with ‘Essential Operations’, covering certain operations (construction, assignment, destruction) that the language makes certain assumptions about. It looks innocuous enough but it is full of essential information. It introduces the ‘rule of zero’ which states “either define all of the essential or none” – coupled with exceptions, this shows how to have memory and other resource handling performed automatically without the need for an explicit Garbage Collector. The next two chapters – ‘Templates’, ‘Concepts and Generic Programming’ are mind-bending and I will be supplementing the information given here with other C++ books.

The rest of the book (barring a ‘History and Compatibility’ final chapter which also details when certain features were introduced) is all about the standard library and would have been even better with more examples. It starts with an overview chapter and on to chapters on ‘Strings and Regular Expressions’, ‘Input and Output’, ‘Containers’, ‘Algorithms’, ‘Utilities’, ‘Numerics’, and ‘Concurrency’. The book lacks a Glossary – however, the author provides one online at www.stroustrup.com/glossary.html.

This book is a useful, brief, introduction to C++17 (and hints of C++20 and later standards). I think its unique selling points are its brevity and the advice given by the author.






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.