Book review: C++ Coding Standards: 101 Rules, Guidelines, and Best Practices

There is no official C++ standard, unlike several languages (Java, Python, …) where there are referentials for code and design style, good practices, … It didn’t exist until this book where two world-renowned C++ authors set the basis for your every day development.

101 coding standards, numbered from 0 to 100 (an echo to the fact that C++ starts counting from 0), this is the content of the book.

Content and opinions

The standards are split in several groups, from policy to type safetiness. Each time, the coding standard is stated, with a short summary and then a discussion. There can be an example if needed, and some references. The standard is always simple enough to follow, and the explanation is clear yet complete.

The handled issues are very vast, oriented towards common pitfalls. Use inheritance when needed, use collaboration elsewhere, do not inherit from a class that isn’t made for inheritance, … When you are used to these pitfalls (because a lot of C++ gurus talk about them in their forum posts, mails or blogs), you may sometimes forget them and write code that is not optimal (in several ways, performance or maintenability). The book is in that regard a good way of having the good practices classified by topics and easilly accessed: you don’t have to check or search on the Internet. Finally if someone has a question on why you used a specific coding standard, you can give a full explanation and a context (and spread the good pratices).

Conclusion

C++ Coding Standards are sometimes more a question of style than of language, but they are part of the general pieces of advices one should follow. C++ is a language that permits a lot of things, perhaps too much, and this set of rules makes it possible to write readable, efficient, robust code.

One thought on “Book review: C++ Coding Standards: 101 Rules, Guidelines, and Best Practices”

Leave a Reply