Before you go writing yet another C++ coding style, have you looked at the others that are out there. Place to start is:
http://www.cs.umd.edu/users/cml/cstyle/
I have looked at it, and it is very complete and thorough. On the other hand, we already have a coding standard we are happy with, but we might consider using parts of this or other standards to expand our own. I will add it to the links section of zez.org, as it should be of great interest to many developers. Thanks!
In particular, read the Ellemtel style guide. With respect to your Part 1 & 2, here's some questions to consider:
* Any recommended directory structure to use in a large project?
* Any recommendations on filenames to improve sorting and searching?
* Should filenames use underscore or dash or nothing to separate words in the name?
These questions will be addressed in the next two issues of the article, if I recall correctly.
* Would you recommend macros for portability issues (ie. #ifdef for system types)?
We try to avoid this, but we do use it when it would be cumbersome not to.
* Should C++ keywords be surrounded by whitespace to prevent confusion with function names (ie. ease grepping)?
I prefer this. Generally speaking, I think whitespace is a good thing. It improves readability, and most people today have large enough screens to handle the extra length of the code.
* What do you think of this style for function definitions?
int // returning position in array
FindItem(
char* string // item to search for
) {
...
}
We use the Doxygen syntax to document our functions, and we prefer having curly brackets {} on separate lines and equal columns. However, having the function arguments on separate lines, enabling comments for each argument, seems a good idea. When using descriptive function and argument names these extra comments are rarely needed, so we currently don't use this.
* Have you looked at tools for literate programming like the following?
http://www.w3.org/Tools/Prog_lang_filters.html
Have not, will do.
regards, Gunnstein
|