diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-17 04:23:09 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-01-17 04:23:09 -0500 |
commit | 8b5e391afbc5befa47cf62a925defd5a9b5b31e8 (patch) | |
tree | af88f6b012d3aae7b20e5b4d8bf45d430e2bb362 | |
parent | 1e73fd4b1ec3e09a880a7e00527952c647c19fc6 (diff) |
start a STYLE file
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | STYLE | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,34 @@ +This is the openrc style manual. It governs the coding style of all code +in this repository. Follow it. Contact openrc@gentoo.org for any questions +or fixes you might notice. + +########## +# C CODE # +########## + +The BSD Kernel Normal Form (KNF) style is used: + http://en.wikipedia.org/wiki/Indent_style#BSD_KNF_style +Basically, it's like K&R/LKML, but wrapped lines that are indented use 4 spaces. + +Highlights: + - no trailing whitespace + - indented code use tabs (not line wrapped) + - cuddle the braces (except for functions) + - space after native statements and before paren (for/if/while/...) + - no space between function and paren + - pointer asterisk cuddles the variable, not the type + +void foo(int c) +{ + int ret = 0; + + if (c > 1000) + return; + + while (c--) { + bar(c); + ret++; + } + + return ret; +} |