The value returned by a function having non-void return type shall be used
The value returned by a function having non-void return type shall be used.
You can unintentionally call a function with a non-void return
type but not use the return value. Because the compiler allows the
call, you might not catch the omission. This rule forbids calls to
a non-void function where the return value is not
used. If you do not intend to use the return value of a function,
explicitly cast the return value to void.
The checker flags functions with non-void return if the return
value is not used or not explicitly cast to a void type.
The checker does not flag the functions memcpy,
memset, memmove,
strcpy, strncpy, strcat,
strncat because these functions simply return a pointer to
their first arguments.
If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.
| Group: Function |
| Category: Required |
| AGC Category: Readability |