From b0d8a2d31f64805bf083e75d8ed1e5502b1fdab6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 21 Aug 2018 12:56:36 -0600 Subject: [PATCH] Update C coding standard. --- Documentation/NuttXCCodingStandard.html | 36 ++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index 857f2fbcb0..97f346a8a8 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -12,7 +12,7 @@

NuttX C Coding Standard

-

Last Updated: August 7, 2017

+

Last Updated: August 21, 2018

@@ -405,11 +405,23 @@

Line Spacing A single blank line should precede and follow each comment. - The only exceptions are (1) for the file header block comment that begins on line one; - there is no preceding blank line in that case. - And (2) for conditional compilation. - Conditional compilation should include the conditional logic and all comments associated with the conditional logic. - In this case, the blank line appears before the conditional, not after it. + The only exceptions are: +

+
    +
  1. + For the file header block comment that begins on line one; + there is no preceding blank line in that case. +
  2. + For conditional compilation. + Conditional compilation should include the conditional logic and all comments associated with the conditional logic. + In this case, the blank line appears before the conditional, not after it. + No blank lines precede any comments following the conditional. +
  3. +
  4. + With braces. + No blank line separates the beginning left brace from a comment. + No blank line follows a comment that may be the final thing preceding a right brace. +
  5. @@ -425,6 +437,13 @@ #ifdef CONFIG_THE_IMPOSSIBLE the_impossible(); #endif + + if (a == b) + { + + /* Only a comment */ + + }
    @@ -444,6 +463,11 @@ the_impossible(); #endif + + if (a == b) + { + /* Only a comment */ + }