Common code indentation (follow-up to 2007 discussion)

Charles Day cedayiv at
Fri Jun 5 15:18:47 EDT 2009

2009/6/5 Christian Stimming <stimming at>

> Now that we've come back to working on one single branch (trunk), we should
> reconsider the idea from back in 2007: We should re-indent the whole code
> into one single indentation scheme. See
> Quote from there: I'd like to propose the following "indent" options.
> Indentation
> -nut    No tabs. Indentation is done with spaces.
> -i4     Add four spaces for each indent level
> -ci4    Continuation lines are indented by four spaces
> -cli4   Case labels are indented by four spaces
> -ppi4   Nested pre-processor defines are indented by four spaces
> -nbc    Do not force newlines after commas in declarations (default)
> -nbfda  Don´t put each argument in a function declaration
>        on a separate line (default)
> -lp     Line up continued lines at parentheses (default)
> -psl    Put the type of a procedure on the line before its name.
> -bbo    Prefer to break long lines before boolean operators.
> Blank Lines
> -nsob   Do not swallow optional blank lines (default)
> -bad    Force a blank line after a declaration.
> -bbb    Force a blank line before a block comment.
> -bap    Force blank lines after procedure bodies.
> Comments
> -fca    Reformat all comments except those starting in column 1
> -fc1    Reformat comments starting in column 1
> -sc     Continuation lines in a comments start with a '*'
> [Added from discussion:]
> -lc80 Comment line width of 80
> Statements
> -npcs   Do not put space after the function in function calls.
> -nprs   Do not put a space after every ´(´ and before every ´)´.
> -ncs    Do not put a space after cast operators.
> -saf    Put a space after each for.
> -sai    Put a space after each if.
> -saw    Put a space after each while.
> [Added from discussion:]
> -ss On one-line for and while statments, force a blank before the
> semicolon.
> -brs    Put braces on struct declaration line.
> -br     Put braces on line with if, etc.
> -ce     Cuddle else and preceeding `}´.
> -cdw    Cuddle while of do {} while; and preceeding `}´.
> Other
> -l80    Line width of 80.
> [Discussion ended unclear on this one. Maybe -l95 instead.]
> If this is agreed upon, someone needs to actually apply this patch. (I'm
> rather short on time to do this, but would do it if nobody else steps up.)

I strongly prefer -bl to -br. Easier to visually match parens makes it
easier to read, harder to make mistakes. It adds lines, but is worth it in
my opinion. I like the rest, though personally I prefer two spaces for
indents rather than four. It helps reduce line breaks and I still find it
quite readable.

Just my 0.02,

> In any case, right now is a good time to do this, so we should do it.
> Regards,
> Christian

More information about the gnucash-devel mailing list