wiki:CppCodingStandards

Version 2 (modified by dtodd, 10 years ago) (diff)

--

C++ Coding Standards

Overview

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++:

Resources

Bjarne Stroustrup's C++ Style and Technique FAQ: http://www.research.att.com/~bs/bs_faq2.html

Great website (For all things C++, STL, C) : http://www.cplusplus.com/

Coding Standards

Good Books

Intermediate and Advanced

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

Beginning

C++ Primer Plus, by Stephen Prata

Meta rules for Coding Standards

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

Proposed Standard