![]() |
![]() |
3113 | ![]() |
||||
![]() | |||||||
| Explicitly undefined | REFERENCE - ISO:C90-6.6.6.4 The return Statement - Semantics | ||||||
This return statement has no return expression. However, the function has actually been defined without an explicit return type and so the C language assumes a return type of int. Omitting to specify an explicit type when declaring either a function or an object is not recommended. Messages 2050 or 2051 will be generated. If it is really intended that this function should not return a value, amend the definition so that the return type is explicitly declared as void. For example:
/*PRQA S 2017,2201,3408 ++*/
extern f1(void) { /* Message 2050 */
return 1;
}
extern f2(void) { /* Message 2050 */
return; /* Message 3113 */
}
MISRA C:2012 Rules applicable to message 3113:
| Rule-1.3 (Required) | There shall be no occurrence of undefined or critical unspecified behaviour |
| Rule-17.4 (Mandatory) | All exit paths from a function with non-void return type shall have an explicit return statement with an expression |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |