On 1/3/2020 7:46 AM, Nathan Hartman wrote:
On Fri, Jan 3, 2020 at 2:23 AM Xiang Xiao <xiaoxiang781...@gmail.com> wrote:

3.It make the code a little bit clean(e.g. memcpy... vs. (void)memcpy...)
4.The return value from many function don't indicate the pass/fail(e.g.
memcpy return destination), it is reasonable to ignore it silently if the
caller don't use that information.

I think in the context of the original requirement, it is clear it is referring only to error returns.  And it also excludes OS functions that have historically ignored the return value (printf(), close(), and also memset()).  There is nothing wrong with the requirement.
**

*Checking Return Values*. 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 (void) 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 printf() or close*/. All calls to malloc or realloc must be checked for failures to allocate memory.

Reply via email to