You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/01/03 15:27:58 UTC
[incubator-nuttx] 12/13: 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.
gnutt pushed a commit to branch netlink_crypto
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 312596049c8d075c2ee633f00261444a19ba3458
Author: Gregory Nutt <sp...@gmail.com>
AuthorDate: Fri Jan 3 09:55:10 2020 -0300
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%">