From f2f5a7bca5e77971ef71bf2ddabf93868fe79f1d Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Wed, 17 Aug 2016 10:57:48 -0400 Subject: [PATCH 1/1] CODING: one-line if statements should not have braces Update the style guide with a declaration of the prevailing and preferred brace style for one-line if statements and loops. Provide an example and counter-example. Change-Id: Iafeea977203b76c0e67385779fb4ed57f3c6699a Reviewed-on: https://gerrit.openafs.org/12370 Reviewed-by: Stephan Wiesand Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- CODING | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CODING b/CODING index f8a3fd4..fe64431 100644 --- a/CODING +++ b/CODING @@ -93,7 +93,29 @@ Example: * like this example. */ - +Do not use braces on one-line if and loop statements. + +Use: + + if (some_condition) + do_some_action(); + else + do_something_else(); + + while (some_condition) + do_something(); + +Instead of: + + if (some_condition) { + do_some_action(); + } + + while (some_condition) { + do_something(); + } + + Dependencies required to build OpenAFS from source -------------------------------------------------- The following packages are required to build all of the OpenAFS code -- 1.9.4