diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html
index 7d65a766a26..a116f981e7c 100644
--- a/Documentation/NuttXCCodingStandard.html
+++ b/Documentation/NuttXCCodingStandard.html
@@ -12,7 +12,7 @@
NuttX C Coding Standard
- Last Updated: May 6, 2017
+ Last Updated: June 9, 2017
@@ -736,12 +736,25 @@ void some_function(void)
-
Always on Separate Lines.
- Braces always appear on a separate line containing nothing else other that white space.
+ Braces always appear on a separate line containing nothing else other than white space.
-
Never Comments on Braces.
Do not put comments on the same line as braces.
+ -
+ Compound Statements.
+ Within this document, an opening left brace followed by a sequence of statments, and ending with a closing right brace is refered to as a compound statement.
+
+ -
+ Nested Compound Statements.
+ In the case where there are nested compound statements that end with several consecutive right braces, each closing right brace must lie on a separate line and must be indented to match the corresponding opening brace.
+
+ -
+ Final brace followed by a single blank line.
+ The final right brace must be followed by a blank line as per standard rules.
+ In the case where there are nested several consecutive right braces, no blank lines should be inserted except for after the final right brace.
+
-
Special Indentation Rules.
Special indentation rules apply to braces.
@@ -763,6 +776,19 @@ while (true)
...
} /* not valid */
} /* end forever */
+if (a < b) {
+ if (a < 0) {
+ c = -a;
+ } else {
+ c = a;
+ }
+} else {
+ if (b < 0) {
+ c = -b;
+ } else {
+ c = b;
+ }
+}
|
@@ -779,12 +805,36 @@ while (true)
...
}
}
+
+if (a < b)
+ {
+ if (a < 0)
+ {
+ c = -a;
+ }
+ else
+ {
+ c = a;
+ }
+ }
+else
+ {
+ if (b < 0)
+ {
+ c = -b;
+ }
+ else
+ {
+ c = b;
+ }
+ }
+
|
- Exceptions.
+ Exception to Indentation Rule for Braces.
The exception is braces that following structure, enumeration, union, and function declarations.
There is no additional indentation for those braces;
those braces align with the beginning of the definition
@@ -854,6 +904,7 @@ int animals(int animal)
{
...
}
+
@@ -2123,11 +2174,15 @@ x++;
Braces and indentation.
- The placement of braces and statements must follow the standard rules for braces and indentation.
+ The placement of braces and statements must follow the standard rules for braces and indentation.
- Followed by a single blank line.
- The final right brace must be followed by a blank line.
+ Final brace followed by a single blank line.
+ The final right brace must be followed by a blank line.
+ This may be the final brace of the if compound statement.
+ Or it may be the the final brace of the else compound statement if present.
+ A blank line never follows the right brace closing the if compound statement if else is present.
+ Use of braces must follow all other standard rules for braces and spacing.