[OpenAFS-devel] coding standards proposal

Nathan Neulinger nneul@umr.edu
22 Jan 2003 19:02:41 -0600


Is it stable? I know a few times I've run indent with certain sets of
options, and it had a tendency to oscillate between two different
outputs when run more than once. 

Looks like this option set appears stable (at least with a few files I
tested) after you have run it once with the newlines option, and a
second time without the newlines option. Subsequent runs appear stable. 

Resulting output I didn't like much:

{
    int retVal;
    H_LOCK retVal = MultiBreakCallBackAlternateAddress_r(host, afidp);
    H_UNLOCK return retVal;
}

There's a bunch of formatting artificacts with H_LOCK and H_UNLOCK
elsewhere as well... We probably need to add semicolons to H_LOCK macro
invocations. 

I'd like to see these added/changed, but neither is critical. 

	-bad instead of -nbad (blank line after declarations)
	-ts4 instead of -ts8 (so tabs matches the indent spaces - otherwise,
code is unreadable on a edit set with tabstop=4)

Wish there were a --add-preprocessor-space option to indent the
preprocessor ifdef/includes, but only option is for removing the space
or leaving as is. 

-- Nathan

On Wed, 2003-01-22 at 18:00, Derrick J Brashear wrote:
> 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
> 
> 
> 
> _______________________________________________
> OpenAFS-devel mailing list
> OpenAFS-devel@openafs.org
> https://lists.openafs.org/mailman/listinfo/openafs-devel
-- 

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216