PDA

View Full Version : C++ Coding Standard



confuted
05-20-2003, 05:27 PM
I just found this page, and thought that it was fairly interesting reading, so I decided that I would pass the link along to all y'all. I'm not sure if it is the official standard or not, but it looks good to me. (didn't read it all)

http://www.possibility.com/Cpp/CppCodingStandard.html

Xei
05-20-2003, 07:19 PM
That is quite long, and even though it may cover much of the standards I do not believe that it is legitimate. I just think that a standard would be much more specific, and professional, than just saying


int
some_bloody_function()
{
}

Zach L.
05-20-2003, 08:00 PM
I doubt the ANSI C++ committee would endorse an 'official' set of coding standards.

It does look good and rather thorough, though it is a bit excrutiatingly long.

the Wookie
05-20-2003, 08:06 PM
i like the "Flow Chart for Project Decision Making"

good stuff :p


http://www.possibility.com/Cpp/CppCodingStandard.html#flow

beege31337
05-21-2003, 11:20 AM
Coding standards are usually set by the company you work for.

If you don't work for a company, choose the standards which you think are best and stick to them.

Prelude
05-21-2003, 12:28 PM
>If you don't work for a company, choose the standards which you think are best and stick to them.
And keep an open mind. Be prepared to change your mind and use another style if your tastes change or you find a strong argument against what you use. Case in point: As many people here probably know, my style has been very unique (to my knowledge):


#include <stdio.h>

/*
** K&R bracing,
** Lots of whitespace between tokens,
** Two space indention
*/
int main ( void )
{
int i;

for ( i = 0; i < 10; i++ ) {
printf ( "%d\n", i );
}

return 0;
}

Recently though, I've begun to fall into a more common style and found it to be more pleasing as well as easier to write:


#include <stdio.h>

/*
** Allman bracing,
** Less whitespace between tokens,
** Four space indention
*/
int main(void)
{
int i;

for (i = 0; i < 10; i++)
{
printf("%d\n", i);
}

return 0;
}

Shadow
05-21-2003, 01:08 PM
> or you find a strong argument against what you use.
I do not argue against your new change, in fact, that is what I use despite the fact that I am no where near as knowledgable as you. Seems less jumbled IMO.

Oh, and welcome back Prelude. :)