Jonathan Boccara's blog

What Books to Read to Get Better In C++

Published July 28, 2017 - 12 Comments

To write good C++ code and master the language, there are a lot of things that you need to know.

Practice plays an important role in this, but practice only won’t tell you all. And far from it.

The C++ community benefits from a large selection of books, that contain a large part of the ground you need to cover to become proficient in C++.

As I’m often asked what books are worth reading, I’ve put together a list of books that taught me a large part of what I know in C++ today. The rest has come from other sources such as conferences, blogging, giving trainings, exchanging with other developers, and practice. But those books gave me a solid ground upon which to build all of this.

C++ books

What follows is my personal list so it is not comprehensive: there are good books out there that I haven’t read yet, and good books that I have omitted in order to prioritise. So you may find some of your preferred titles missing from that list. But it’s ok, since those I’ve included will make you improve your skills in C++ anyway.

I haven’t included to books that teach you the syntax of the language though, since I have used online tutorials and references for this purpose and it wasn’t the most differentiating part. At least for me.

Code complete

Code complete C++There is one book that you need to read in top priority for writing solid code: Code Complete from Steve McConnell. In fact this books teaches you things that go beyond one particular language, and which are relevant to C++ too.

The French translation of this book is the equivalent of “All about the code”, and it says it all. In this book you’ll learn how to write an if statement correctly, how to handle errors in code, how to design classes and modules and how to attribute responsibilities to them. You’ll also learn about comments, code reviews, respecting levels of abstraction and designing interfaces. And about much, much more. It’s all backed up with research papers. Some companies even put Code Complete as mandatory reading for their new joiners.

It’s a big book, but every page is worth it. You’ll never be the same person after reading that book. At least when it comes to coding šŸ˜Š.

Effective C++

Effective C++This one is the top priority for writing solid code, but specifically in C++ this time. In Effective C++, Scott Meyers shows how to use the language correctly and to avoid a lot of pitfalls. And most of these pitfalls you can’t guess, even with a fair amount of practice.

Even though the book was written well before C++11 came out, most of its contents are still valid today. It has been complemented (and not replaced) by another book that focuses on Modern C++ practices (see below).

I think that you can’t code seriously in C++ without reading this book. I’d recommend to read it twice to make sure you retain as much as possible from it.

Plus, it is well structured in small items and the writing style of Scott is pleasant to follow.

More Effective C++

More Effective C++Now that we’ve got those two down, the rest is a matter of getting better at the subject.

More Effective C++ is the sequel of Effective C++. It contains more idioms and pitfalls, and touches upon more sophisticated design problems, such as shared resources, Ā multiple dispatch and stack versus dynamic memory allocation.

Once again, it was written before C++11, but most of it is still applicable today and has no overlap with the modern versions of the book series.

Effective Modern C++

Effective modern C++This is the sequel of the Effective C++ series, but for modern C++. That is, C++11 and C++14. Effective Modern C++, as its predecessors, covers a wide scope of modern C++ features. From lambdas to decltype and auto, to concurrency, move semantics and uniform initialisation. It explains how things works and how to choose between different solutions, and help you stay away from the bad usages of the new features.

I have found it more technical and difficult to read than the earlier books, but it’s an important read nonetheless.

Exceptional C++

Exceptional C++Exceptional C++ and its sequels are the books of Herb Sutter, who is no less than the Chair of the ISO C++ Standard Committee.

Exceptional C++ covers more advanced topics than Effective C++ and More Effective C++, and for this reason I’d advise to read it after you’re done with the former ones.

As its name suggests, the books devotes a large part to writing exception safe code. It is very well structured, and this is the best resource I know on this topic. However, given that the book was released well before C++11, I am not sure how modern C++ has impacted the topic of writing exception safe code.

Exceptional C++ also goes in depth into the pimpl idiom and the Interface Principle. And it covers plenty of other smaller subjects too. It is a great read to get better in C++.

More Exceptional C++

More Exceptional C++As a sequel to Exceptional C++, More Exceptional C++ gets even deeper into exception safety, and cover more topics as a complement to the previous book.

The STL occupies a sizeable part of the book. It also covers a lot of other topics, namespace and inheritance amongst others, and on their more advanced aspects.

Modern C++ Design

Modern C++ DesignAndrei Alexandrescu’s Modern C++ Design is my all time favourite C++ book. Its purpose is to implement design patterns, by using templates. But it does much, much more.

The book starts off with a few chapters presenting basic metaprogramming components. Even if the book had stopped after these chapters, it would have already brought great value! These components are a great introduction to the type system of C++, and provide the reader with a better understanding of the language.

Then the following chapters implement design patterns by using the concept of policies, which allow forĀ modular design within the different aspects of a class.Ā This book has been an eye opener for me.

It has been written a while ago (2001), and some parts have been made obsolete by new features of the language, such as typelists with variadic templates. But all in all, I think the book remains a great read.

As a matter of fact, Andrei is also a brilliant presenter. If you have a chance, I’d recommend you watch any of his talks.

Modern C++ Cookbook

Even though I haven’t read this book yet, Modern C++ Cookbook seems very interesting as it came out recently and focuses on the features brought by Modern C++, that is C++11, C++14 and C++17. And there aren’t so many books talking about these latest features out there yet. It’s a cookbook so you can read any part of it that suits your specific need, and Bartek has made a very good review on it. I encourage you to read its review and make your decision.

Modern C++ cookbook

Effective STL

Effective STLIn the Effective Series, Scott Meyers also wrote Effective STL. This books explains how to use the part of the language that concerns containers and algorithms. It is a mine of information to get a good understanding of the STL.

Note that it covers a part of the language that has been deprecated since it came out: bind1st, bind2nd, unary_functionĀ and binary_function, ptr_fun, mem_funĀ and mem_fun_ref. You can safely skip this part, that has been superseded by lambdas in C++11, and deprecated.

In fact, another book came out on the STL more recently, the C++17 STL Cookbook, with an emphasis on C++17. Although I didn’t get a chance to read it yet, it’s written by Jacek Galowicz who’s a top-level C++ developer, so I’m not worried about the quality of the contents.

c++17 books

The boost C++ libraries

c++ booksThe Boost C++ Libraries is a reference book that shows a lot of boost libraries with a very practical approach and clear explanations. It is useful when you’re looking for information on a particular library and the official documentation seems hard to read to know what it’s about. But you can also read it in any order, if you just want to look at advanced usages of C++ in order to take inspiration for your own libraries. This is a great thing to do.

This book is… a book, so it’s been written once. I don’t know if there will be future editions, but the one available today uses Boost 1.56. This means that it doesn’t have the more recent libraries such as Hana or Beast for example.

But what is nice is that it’s available online for free. However you may find it nice to carry it with you in paperback to the beach or to any other place where you can sit back and relax. Cos it’s what everyone does when they feel like chilling out, learn about the boost libraries, right?

C++ Template Metaprogramming

C++ Template MetaprogrammingIf you’re curious about template metaprogramming, Dave Abrahams’s and Alexey Gurtovoy’s C++ Template Metaprogramming will show you things that defy the imagination.

TMP is a language within the language and with it you can manipulate collections, iterators and such, at compile time. That’s pretty impressive, albeit rather technical. The books also delves into DSEL (Domain Specific Embedded Languages) and preprocessor metaprogramming (!).

It is a very interesting read, but you won’t miss it if you’re not interested in template metaprogramming. So read the other books of this list in priority before getting to this one!

Feel like reading now?

This is my list! I’ll grow it in the future, with other books that can bring you value.

I hope this motivates you to pick up at least a few of these – if you haven’t read them yet. Reading is important to get solid bases in C++!

Oh and, all of the above links are affiliates. So if you do decide to pick up one of them after reading this list I’ve put together, I’d be grateful if you show support and click through those links!

Related articles:

Share this post! Facebooktwittergoogle_pluslinkedin    Don't want to miss out ? Follow:   twitterlinkedinrss

Receive regular updates to make your code more expressive.