![]() |
|
MISRA C:2012 Rule-15.5: (Advisory) |
|
||||
![]() | |||||||
Amplification:
A function should have no more than one return statement.
When a return statement is used, it should be the final statement in the compound statement that forms the body of the function.
Example Code:
#include "misra.h"
#include "m3cmex.h"
extern int16_t rule_1505( void ) /* 2889 */
{
if ( s16a > 0 )
{
return 0;
}
else
{
return 1;
}
}
QAC messages that encompass this guideline:
| 2889 | This function has more than one 'return' path. |
|
||
(c) The Motor Industry Research Association, 2012
|
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0 © 2013 Programming Research www.programmingresearch.com |
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |