diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2016-03-14 14:31:14 +0100 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2016-03-14 14:31:14 +0100 | 
| commit | 0fc73d364e2cf80e801caae3cadfbaa2c0b8cebe (patch) | |
| tree | b4f884e33778e37cb3b44deb242504cd80bf642a | |
| parent | 4ef6d6b1bc8c4345f81531274492f188c8e99976 (diff) | |
CODE_STYLE: Space around operators
As just discussed on the mailing list, also document how we prefer
spacing in expressions.
| -rw-r--r-- | docs/CODE_STYLE.md | 19 | 
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  | 
