Details
-
Type:
Language-Specification
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Impact:Unknown 'null' severity
-
Likelihood:Unknown 'null' severity
Description
Exceptions
This rule doesn't raise an exception when the return statement for a void function, is itself a void expression.
void foo() { // Do stuff ... } void bar() { return foo(); }
See
- MISRA C:2004, 16.8 - All exit paths from a function with non-void return type shall have an explicit return statement with an expression
- MISRA C++:2008, 8-4-3 - All exit paths from a function with non-void return type shall have an explicit return statement with an expression
- MISRA C:2012, 17.4 - All exit paths from a function with non-void return type shall have an explicit return statement with an expression
- MITRE, CWE-394 - Unexpected Status Code or Return Value
- CERT, MSC37-C. - Ensure that control never reaches the end of a non-void function
- CERT, MSC52-CPP. - Value-returning functions must return a value from all exit paths
- CERT, MSC53-CPP. - Do not return from a function declared [[noreturn]]