Update 'Coding Style'

Patrick Vogler 2023-06-21 14:50:46 +00:00
parent 0a4538ca06
commit 7b8bafd7c6

@ -51,8 +51,19 @@ while ((c = *str++))
hash = (hash * 33) ^ c; hash = (hash * 33) ^ c;
} }
``` ```
Continuation lines should align wrapped elements with the first argument (excluding reference operators) or use a hanging indent. When using a hanging indent, there should be no arguments on the first line and all subsequent "hanging" lines should be indented with 2 spaces in relation to the calling command:
#### Aligned Along First Deliminator
```c ```c
# Correct
error = initialize_tagtree(&prec_control->tag_inclusion,
prec_control->numCbX,
prec_control->numCbY,
prec_control->numCbZ,
prec_control->numCbTS)
exit(error);
# Wrong
error = initialize_tagtree(&prec_control->tag_inclusion, error = initialize_tagtree(&prec_control->tag_inclusion,
prec_control->numCbX, prec_control->numCbX,
prec_control->numCbY, prec_control->numCbY,
@ -60,7 +71,19 @@ error = initialize_tagtree(&prec_control->tag_inclusion,
prec_control->numCbTS) prec_control->numCbTS)
exit(error); exit(error);
``` ```
#### Hanging Indent
```c ```c
# Correct
error = initialize_tagtree(
&prec_control->tag_inclusion,
prec_control->numCbX,
prec_control->numCbY,
prec_control->numCbZ,
prec_control->numCbTS);
exit(error);
# Wrong
error = initialize_tagtree( error = initialize_tagtree(
&prec_control->tag_inclusion, &prec_control->tag_inclusion,
prec_control->numCbX, prec_control->numCbX,