From e4b71a06bba813396144c3af8639d3d965c650f0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 6 May 2017 15:18:39 -0600 Subject: [PATCH] Update the C coding standard. --- Documentation/NuttXCCodingStandard.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index f867fb3782a..7d65a766a26 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -12,7 +12,7 @@

NuttX C Coding Standard

-

Last Updated: April 18, 2017

+

Last Updated: May 6, 2017

@@ -405,8 +405,11 @@

Line Spacing A single blank line should precede and follow each comment. - The only exception is for the file header block comment that begins on line one; + 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.

@@ -416,6 +419,12 @@ a = b; /* set b equal to c */ b = c; + + /* Do the impossible */ + +#ifdef CONFIG_THE_IMPOSSIBLE + the_impossible(); +#endif
@@ -430,6 +439,11 @@ b = c; +#ifdef CONFIG_THE_IMPOSSIBLE + /* Do the impossible */ + + the_impossible(); +#endif
@@ -1611,7 +1625,7 @@ enum xyz_state_e
  • Lowercase Exceptions. - There are3 a few lower case values in NuttX macro names. Such as a lower-case p for a period or decimal point (such as VOLTAGE_3p3V). + There are a few lower case values in NuttX macro names. Such as a lower-case p for a period or decimal point (such as VOLTAGE_3p3V). I have also used lower-case v for a version number (such as CONFIG_NET_IPv6). However, these are exceptions to the rule rather than illustrating a rule.