You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/01/03 12:53:56 UTC
[incubator-nuttx] branch pr31 updated:
Documentation/NuttXCCodingStandard.html: Remove requirement to decorate
ignored returned values with (void). (#31)
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch pr31
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/pr31 by this push:
new 180942c Documentation/NuttXCCodingStandard.html: Remove requirement to decorate ignored returned values with (void). (#31)
180942c is described below
commit 180942cf6ea3bcf944196891b8c2f9342ec9340b
Author: patacongo <sp...@yahoo.com>
AuthorDate: Fri Jan 3 06:53:49 2020 -0600
Documentation/NuttXCCodingStandard.html: Remove requirement to decorate ignored returned values with (void). (#31)
Co-authored-by: Gregory Nutt <gn...@nuttx.org>
---
Documentation/NuttXCCodingStandard.html | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html
index 2b187b5..74522f2 100644
--- a/Documentation/NuttXCCodingStandard.html
+++ b/Documentation/NuttXCCodingStandard.html
@@ -87,7 +87,7 @@
<h1><big><font color="#3c34ec">
<i>NuttX C Coding Standard</i>
</font></big></h1>
- <p>Last Updated: July 6, 2019</p>
+ <p>Last Updated: January 2, 2020</p>
</td>
</tr>
</table>
@@ -2182,9 +2182,8 @@ ptr = (FAR struct somestruct_s *)value;
<b>Checking Return Values</b>.
Callers of internal OS functions should always check return values for an error.
At a minimum, a debug statement should indicate that an error has occurred.
- The calling logic intentionally ignores the returned value, then the function return value should be explicitly cast to <code>(void)</code> to indicate that the return value is intentionally ignored.
- An exception of for standard functions for which people have historically ignored the returned values, such as <code>printf()</code> or <code>close</code>.
- All calls to <code>malloc</code> or <code>realloc</code> must be checked for failures to allocate memory.
+ Ignored return values are always suspicious.
+ All calls to <code>malloc</code> or <code>realloc</code>, in particular, must be checked for failures to allocate memory to avoid use of NULL pointers.
</p>
<table width ="100%">