Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All expression statements, such as function calls with an ignored value, are implicitly cast to void. Since a return value often contains important information about possible errors it should always be checked, otherwise the cast should be made explicit to signify programmer intent. If a function returns no meaningful value it should be declared with return type void.

This is a general recommendation encompassing encompasses MEM32-C. Detect and handle memory allocation errors, FIO04-A. Detect and handle input and output errors and FIO34-C. Use int to capture the return value of character IO functions.

...