From 9be93c710a04523146942cd0983520c260719784 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 6 Jul 2019 13:08:27 -0600 Subject: [PATCH] Documentation/NuttXCCodingStandard.html: Another small change discouraging the practice of enclosing the value argument of 'return' statements in parentheses. --- Documentation/NuttXCCodingStandard.html | 49 ++++++++++++++----------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index f131dc100b..2b187b50fc 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -87,7 +87,7 @@

NuttX C Coding Standard

-

Last Updated: July 5, 2019

+

Last Updated: July 6, 2019

@@ -2092,7 +2092,14 @@ ptr = (FAR struct somestruct_s *)value; As a rule of thumb, the length of a function should be limited so that it would fit on a single page (if you were to print the source code).
  • - Space after the function body + Return Statement. + The argument of the return statement should not be enclosed in parentheses. + A reasonable exception is the case where the returned value argument is a complex expression and where the parentheses improve the readability of the code. + Such complex expressions might be Boolean expressions or expressions containing conditions. + Simple arithmetic computations would not be considered complex expressions. +
  • +
  • + Space after the function body. A one (and only one) blank line must follow the closing right brace of the function body.
  • @@ -2121,7 +2128,7 @@ ptr = (FAR struct somestruct_s *)value; } } - return e / a; + return (e / a); } @@ -2129,28 +2136,28 @@ ptr = (FAR struct somestruct_s *)value;

    Correct