Skip to content

Commit

Permalink
CODING: one-line if statements should not have braces
Browse files Browse the repository at this point in the history
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 <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
  • Loading branch information
meffie authored and kaduk committed Sep 11, 2016
1 parent f0fa5a5 commit f2f5a7b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion CODING
Expand Up @@ -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
Expand Down

0 comments on commit f2f5a7b

Please sign in to comment.