Version 3 (modified by dtodd, 11 years ago) (diff)


C++ Coding Standards


Below I will describes in Gory detail suggested guidelines for C++ code. These rules apply to new code: new files, new modules, new projects.

When editing an older file to fix a minor bug, etc, I think it's prudent to make small changes to the source. In this case, it will be best for readability if you use the standard that was there previously. Than includes following the established indentation, placement of curly brackets "{}", naming conventions, etc.

Obviously if the code requires a complete rewrite, then use the suggested coding standards listed below.

Here are some resources and books I like for learning C++, coding standards, and general conventions for C++. As of this writing (July 2009) C++ is scheduled for a major revision (, and I imagine many new books will come out and make some of my original suggestions obsolete:


Bjarne Stroustrup's C++ Style and Technique FAQ:

Great website (For all things C++, STL, C) :

Coding Standards

Good Books

Intermediate and Advanced

Effective C++, and More Effective C++, by Scott Meyers


C++ Primer Plus, by Stephen Prata

Coding Standards (Meta Rules)

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices, by Herb Sutter and Andrei Alexandrescu.

"look upon this primarily as a set of meta-rules... and ignore this book at your peril"

  • Bjourne Strousturp


  • Effective STL, by Scott Meyers
  • C++ Templates: The Complete Guide, by David Vandevoorde and Nicolai M. Josuttis

Proposed Standard