1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

CODE_STYLE: Space around operators

As just discussed on the mailing list, also document how we prefer
spacing in expressions.
This commit is contained in:
Daniel Stenberg 2016-03-14 14:31:14 +01:00
parent 4ef6d6b1bc
commit 0fc73d364e

View File

@ -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