0. Don’t sweat the small stuff. (Or: Know what not to standardize.)

Summary

Say only what needs saying: Don’t enforce personal tastes or obsolete practices.

Discussion

Issues that are really just personal taste and don’t affect correctness or readability don’t belong in a coding standard. Any professional programmer can easily read and write code that is formatted a little differently than they’re used to.

Do use consistent formatting within each source file or even each project, because it’s jarring to jump around among several styles in the same piece of code. But don’t try to enforce consistent formatting across multiple projects or across a company.

Here are several common issues where the important thing is not to set a rule but just ...

Get C++ Coding Standards: 101 Rules, Guidelines, and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.