Love them or hate them they exist for a multitude of reasons. They are a paradox, both useful and useless. Created with the best intentions by a group of assholes. I am one of those assholes that has contributed to a code spec or two. The fundamental problem in the creation of a coding standard is that it has a multi-asshole paradox, like the highlander there can be only one. The coding standard has a committee of sphincters.
There's an old joke that states a camel is a horse designed by committee. This is what happens to a coding standard. Put a bunch of seasoned, jaded programmers in a room, say n number of programmers and you will get n opinions of how to do everything from painting a fence to shaving back hair. It all goes down hill from there. This group we'll call nProg will bicker over the smallest details and through some alchemy or battle of wills make choices that will affect all of the minions beneath them.
One thing that should happen in this group is at the first mention of the Code Complete book said mentioner shall be cock-punched and ejected from the room. Its not a bad book, its just so full of shit it makes me wretch at its very mention, it cleverly removes the ability for programmers to think for themselves. It is also 18 years old so it kind of suffers from age.
In order for nProg to be effective they need to work independently. You may be sitting back a bit thinking "what the fuck is this dude talking about?" What I'm talking about is breaking the coding standard into core elements and having one member to one element. Sub committees of one if you will. With each overlord having their respective sandbox they can impose their might on a specific element and enjoy the rewards such as how many spaces to indent brings.
This brings me to my point (finally). Here is my coding standard framework for the cloaked wizards that make the choices. they are not commandments but a selection of elements that you may chose to use or respond in comments that I'm a fucking loon.
Carse's Coding Standard For Hotness:
One class per pair of headers and source. Files should be named after the class contained within i.e. MyBadAssClass.hpp MyBadAssClass.cpp.
Use include guards or pragma once I don't care, effectively the same shit.
Header .hpp or .h go crazy
Camel case Horse case brief case again I don't care just choose one style.
_GetOtherCoolStuff I personally hate the underscore and don't give a shit about its history
Get a smart programmer to write this one. A horrifying number of programmers don't understand the differences in public, protected, and private. There also tends to be a loose understanding of public, private, and virtual inheritance.
In practice I avoid multiple inheritance but to each their own. I still screw these up from time to time hence get the smart nerd to write this one out.
Variables and Such:
Use Hungarian, Portuguese, Polish, Pig Latin, whatever floats your boat.
Member variables prefixed with m_
Member pointers prefixed with p_
Function argument prefixed with a_
Enums prefixed with an e
Get the cock punch gloves out again if people start using bitfields to save space for bools its retarded. However if this isn't your element then suck it and let the owner decide.
This will be another 50 page rant at some point. Do you need a singleton? If so build them correctly. If not then just make global static functions. Or make anonymous namespace functions.
Tabs or Spaces:
Truly these can fuck off. The tab key can fuck up formatting between editors. Big fat hairy deal. If you are not using Visual Studio to write code then you are either a meganerd that only uses vi or emacs or you make stuff in xcode for the iWorld. I don't care. The other 99.9999% uses Visual Studio. Stop using that university script kiddie shit and switch to a real IDE. Its one of the few things Microsoft did right. If it is still a huge deal, then set Visual Studio to insert spaces when you use the tab key. That way the professor on his 386 that might look at your code in his archeology project exhuming your computer and corpse will not have the alignment of text all fucked up.
Templates are good, Templates are the Devil's language. Have a smart guy that can read more than 5 pages of Modern C++ Design without falling asleep write this one.
Its all common sense man, just give each grand master his own dojo and everything will be cool. There a a multitude of other pieces to a standard but this should get you going.
Thanks for reading, flame on.