aboutsummaryrefslogtreecommitdiff
path: root/STYLE
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-01-17 04:23:09 -0500
committerMike Frysinger <vapier@gentoo.org>2011-01-17 04:23:09 -0500
commit8b5e391afbc5befa47cf62a925defd5a9b5b31e8 (patch)
treeaf88f6b012d3aae7b20e5b4d8bf45d430e2bb362 /STYLE
parent1e73fd4b1ec3e09a880a7e00527952c647c19fc6 (diff)
start a STYLE file
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'STYLE')
-rw-r--r--STYLE34
1 files changed, 34 insertions, 0 deletions
diff --git a/STYLE b/STYLE
new file mode 100644
index 00000000..f1ae5c1e
--- /dev/null
+++ b/STYLE
@@ -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;
+}