← Back to team overview

cuneiform team mailing list archive

Code style discussion

 

Hi

The current code has no clear style. Every file has slightly (or mayby
I should say wildly) different spacing, braces etc. I have not run the
code through an indenter so that changes made by Cognitive to their
original source would be easier to merge.

At some point we will need to fix this. Thus we need to decide a
coding style. I suggest the Java-like style that I have used in all
new code I have added. You can see it here:

http://bazaar.launchpad.net/~jpakkane/cuneiform-linux/trunk/annotate/head%3A/cuneiform_src/Kern/cuneiform-cli.cpp

The main points are

- indent 4 spaces, NO tabs
- beginning brace is always on the same line as
if/else/for/while/function definition/etc
- no space between if/while/etc and parenthesis, one space after
comma/semicolon, like this:

for(i=0; i<value; i++)

- indent multiline expressions to the opening parenthesis like this:

foo(par1, par2, par3,
     par4, par5);

(If you have a variable width font, or something breaks during
transmission, "par4" should be exactly below "par1".)



Follow ups