CODING STANDARD FOR GERBV $Id: HACKING,v 1.3.10.1 2007/11/27 12:09:09 brorson Exp $ Indentation ----------- To hack in this code you need to set emacs (or whatever you use) to 4 indentation steps and {} at the right places (see code). Not negotiable. My ~/.emacs are: (defun my-c-mode-hook () (turn-on-font-lock) (setq c-basic-offset 4)) (add-hook 'c-mode-hook 'my-c-mode-hook) Curly Braces ------------ if () { blah1(); blah2(); } else { yada1(); yada2(); } If there is only one statement you don't need the braces. for() { do_whatever1(); do_whatever2(); } switch() { case foo: blah1(); break; case bar: blah2(); break; default: break; } Switch should always have a default case. ChangeLog --------- Minor changes (cosmetic, minor (up to 4,5 lines) not reported bugs) doesn't need a ChangeLog entry. A ChangeLog entry is needed when a reported bug is fixed (with bug report number) or when a feature is added. I (spe) use ChangeLog when writing release notes. Functions --------- The prototype should have return type on the same line as function name: int some_function(int par1, int par2); The function implementation should have return type on a separate line (including eventual pointer star). The function implementation should have the function name in c-comments at the closing brace. int * some_function(int par1, int par2) { /* Implementation */ } /* some_function */ In a function there should be maximum one empty line in a row. Between functions there should be two empty lines. Patches --------- Please create patches against the CVS trunk. Don't create patches against any of the branches remaining in CVS -- they are obsolete and will soon go away.