This is an archive of style guides for C and C++ code that I collected in the 1990s. Also archived here are some documents that discuss the value and utility of style guides.
The list includes original versions whenever possible. If you have a working formatter (either LaTeX or troff), the original versions are almost certainly the best. If you've never heard of those old software packages (showing my age here :), start with the HTML version.
All files are copyright by their original authors. I assert a Creative Commons license only for this compilation.
The documents are not listed in any particular order.
- Original Indian Hill guide with annotations by H. Spencer, 15 pages: HTML, troff
- Indian Hill C style guide, as amended at UofT, UW, and elsewhere, 28 pages: HTML, troff
- C++ coding rules from Ellemtel (Swedish Telecom) by
Mats Henricson
and Erik Nyquist, 68 pages:
HTML
This was expanded into a book called Industrial Strength C++ by Mats Henricson and published by Prentice-Hall in 1996 (ISBN 0131209655). - C++ style guide from Wildfire Communications, 46 pages: HTML
- C++ Coding Standard by Todd Hoff, 64 pages: HTML
- Notes on programming in C by Rob Pike, 5 pages: HTML
- C porting guide by A. Dolenc, A. Lemmke, and D. Keppel, 22 pages: HTML, LaTeX
- Ten Commandments for C programmers by Henry Spencer, original (1 page): HTML, troff; and annotated (several pages): HTML
- Henry Spencer's writings on code stealing and reuse, 11 pages: HTML, troff
- A paper about checking for failure codes by Ian Darwin and Geoff Collyer, a paper presented at the January 1985 Usenix conference, 19 pages: HTML
- Tim Ottinger's rules for naming variables and classes, 7 pages: HTML
- Cstyle document from ESA, Australia, 9 pages: plain-text
- Coding standard from the GNU people as of 10 Feb 89, 5 pages: plain-text
- Some discussions about style documents (from Usenet, 1993), 8 pages: plain-text
- More discussion about style documents (from Usenet, 1989), 6 pages; plain-text
- Linux Kernel coding style from Linus Torvalds, 5 pages: plain-text
- C++ style advice called "The Tao of Coding" from Koen Witters, 12 pages: HTML
If you would like a quick way to develop your own style guide
for C, C++, or Java, Sven Rosvall offers a style-document generator.
His page lets you make some choices about various constructs, and the
generator builds a HTML document for you.
http://www.rosvall.ie/CSG/