![]() |
![]() |
2742 | ![]() |
||||
![]() | |||||||
| Invariant operations | |||||||
The controlling expression in this 'if' statement is a constant expression with value zero. The contained code is therefore unreachable. For example:
/*PRQA S 2017,3120,3199,3201,3227,3329,3356,3359,3408,3447 ++*/
#define SWG1 5
#define SWG2 5
int f1(int x)
{
if (SWG1 > SWG2) /* 2742 */
{
++x; /* 2880 */
}
return x;
}
MISRA-C:2004 Rules applicable to message 2742:
| Rule 14.1 (Required) | There shall be no unreachable code. |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |