diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index f131dc100b8..2b187b50fc1 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -87,7 +87,7 @@
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).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.
+ Correct
int myfunction(int a, int b)
- {
- int c;
- int d;
- int e;
- int i;
+ {
+ int c;
+ int d;
+ int e;
+ int i;
- c = a
- d = b;
- e = c + d;
+ c = a
+ d = b;
+ e = c + d;
- for (i = 0; i < a; i++)
- {
- int j;
+ for (i = 0; i < a; i++)
+ {
+ int j;
- for (j = 0; j < b; j++)
- {
- e += j * d;
- }
- }
+ for (j = 0; j < b; j++)
+ {
+ e += j * d;
+ }
+ }
- return e / a;
- }
+ return e / a;
+ }