From 7b8bafd7c60b906a86daa5bed7574d9a92cb03b9 Mon Sep 17 00:00:00 2001 From: Patrick Vogler Date: Wed, 21 Jun 2023 14:50:46 +0000 Subject: [PATCH] Update 'Coding Style' --- Coding-Style.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Coding-Style.md b/Coding-Style.md index d55f35e..6df0575 100644 --- a/Coding-Style.md +++ b/Coding-Style.md @@ -51,16 +51,30 @@ while ((c = *str++)) 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 +# 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, + prec_control->numCbX, + prec_control->numCbY, + prec_control->numCbZ, + prec_control->numCbTS) +exit(error); ``` + +#### Hanging Indent ```c +# Correct error = initialize_tagtree( &prec_control->tag_inclusion, prec_control->numCbX, @@ -68,6 +82,15 @@ error = initialize_tagtree( prec_control->numCbZ, prec_control->numCbTS); exit(error); + +# Wrong +error = initialize_tagtree( + &prec_control->tag_inclusion, + prec_control->numCbX, + prec_control->numCbY, + prec_control->numCbZ, + prec_control->numCbTS); +exit(error); ``` ### Braces