aboutsummaryrefslogtreecommitdiff
path: root/docs/CODE_STYLE.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/CODE_STYLE.md')
-rw-r--r--docs/CODE_STYLE.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/CODE_STYLE.md b/docs/CODE_STYLE.md
index 0dbf87bae..8cfb26e6f 100644
--- a/docs/CODE_STYLE.md
+++ b/docs/CODE_STYLE.md
@@ -130,6 +130,25 @@ and NEVER:
if(a) return TRUE;
else if(b) return FALSE;
+## Space around operators
+
+Please use spaces on both sides of operators in C expressions. Postfix `(),
+[], ->, ., ++, --` and Unary `+, - !, ~, &` operators excluded they should
+have no space.
+
+Examples:
+
+ bla = func();
+ who = name[0];
+ age += 1;
+ true = !false;
+ size += -2 + 3 * (a + b);
+ ptr->member = a++;
+ struct.field = b--;
+ ptr = &address;
+ contents = *pointer;
+ complement = ~bits;
+
## Platform dependent code
Use `#ifdef HAVE_FEATURE` to do conditional code. We avoid checking for