[OpenAFS-devel] coding standards proposal

Derrick J Brashear Derrick J Brashear <shadow@dementia.org>
Wed, 22 Jan 2003 19:00:38 -0500 (EST)


In view of the code base we started with, and after looking at a document
MIT uses to define coding standards, I propose the following. It's not
"religion" because this isn't what I do for code I write. Please
comment, but keep it technical and don't bring your religion into it
either.

--
The "bootstrap" run with use GNU indent with --ignore-newlines and the
options below. Subsequently only the options below would be used.

This should correspond to these indent options:
-nbad -bap -nbc -bbo -br -ce -cdw -brs -ncdb -cp1 -ncs -di2
-ndj -nfc1 -nfca -hnl -i4 -lp -npcs -nprs -psl -sc -nsob -ts8


-nbad: no-blank-lines-after-declarations
-bap: blank-lines-after-procedures
-nbc: no-blank-lines-after-commas (in declarations)
-bbo: break-before-boolean-operator (so && o would start the next line)
-br: braces-on-if-line ( if (foo) { instead of the brace being on the next line)
-ce: cuddle-else (} else instead of the else being on the next line)
-cdw: cuddle-do-while (} while instead of while being on next line)
-brs: braces-on-struct-decl-line (struct foo {)
-ncdb: no-comment-delimiters-on-blank-lines (so /* foo */ doesn't become 3 lines)
-cp1: else-endif-column1 (one space between #else and /* foo */)
-ncs: no-space-after-casts
-di2: declaration-indentation2 (int foo; but 
char foo,
 bar;)
-ndj: no-declaration-justify
-nfc1: dont-format-first-column-comments (plus the below:)
-nfca: dont-format-comments (combine to not reformat comments)
-hnl: honour-newlines (only after first run as above)
-i4: 4 character indent
-lp: continue-at-parentheses (foo(char *foo,
                                  int bar))
-npcs: no-space-after-function-call-names
-nprs: no-space-after-parentheses
-psl: procnames-start-lines (return type appears above, so ctags will work)
-sc: start-left-side-of-comments (a comment line after a /* line would get a * prefix)
-nsob: leave-optional-blank-lines
-ts8: 8 column tab stops