Neither the C nor C++ languages require developers to use the value returned by any function. It is totally acceptable to define a function that returns an integer and then invoke it in the code, ignoring its return value.
Such flexibility often causes software errors that may be difficult to diagnose and fix. Most commonly, it happens for functions returning error code. Developers may forget to add error condition checks for functions that are used often and rarely fail, such as close.
One of the most widely used coding standards for safety-critical systems is MISRA. It defines requirements for C and C++ languages—MISRA C and MISRA C++, respectively. A recently introduced Adaptive AUTOSAR defines coding guidelines for the automotive industry. It is expected that the Adaptive AUTOSAR guidelines will be used as a...