Effective Modern C++ by Scott Meyers

Posted on Jul 7, 2015
Berlin, Germany

Note 2015-08-11: See my post on Meyers’ Effective C++ here

I’m currently working on a project that involves a fair amount of linking and calling into C and C++ libraries. While I’ve taken courses on C and C++ before, most of my development experience has been working SDKs that run on top of virtual machines, namely Java and .NET. Native development has always interested me, as I find the abstractions proffered by higher-level languages are really only used effectively through a process of working on the smaller-scale, namely with programs where not everything’s as easy as pulling in a Nuget or Maven dependency and rolling. Having to think about dealing with memory allocation and deallocation, for example, provides one insight into how garbage collection in managed environments works. Having to cross-compile a bunch of libraries for architectures that weren’t even around when the author wrote the library, is an instructing task. It’s enjoyable because it feels that it’s possible to fix things when they’re wrong, because nothing’s really hidden from you. That’s an exaggeration, of course, but the compile-link-run process is much more transparent in C and C++ than with other development platforms.

One thing that a “managed” developer notices right away, when working in managed code, is that a lot of the learning materials are, well, old! The native guys haven’t done enough of a good job of marketing their language as, for example, most of the newer javascript libraries have. Browsing around Stack Overflow, looking for some recommendations on what to read to get back into the C++ development cycle, I found this wiki. The books that were the most interesting were the ones that were updated for C++11 and C++14. My thought was “learn the old C++98, it’s all obsolete anyway?” (we’ll come back to that in a second). Effective Modern C++ looked like it fit the bill, and my local library in Berlin had an English copy.

After reading through the 42 tips from Effective Modern C++, a few things became immediately clear. The first is that Scott Meyers is a great technical writer. He writes in a way that makes it feel like he’s talking to you, rather than lecturing you. He brings you, the reader, into a dialog without you having to do anything. It’s not a writing style that you find commonly in technical books.

The second thing that became clear is that, although C++11 really improved the language, it builds on top of C++98, and having a firm basis of understanding of C++98 and the STL is essential to effective programming in C++, even if you’re using the newer auto templates or []lambdas. This book assumes you already are very familiar with older versions of C++, which wasn’t the case for me. I still extracted a lot of useful information from the book, and the first thing I did after finishing it was reserve the older versions of Effective C++ and Effective STL, also by Meyer. I’m looking forward to reading them.