![]() |
![]() |
2991 | ![]() |
||||
![]() | |||||||
| Invariant operations | |||||||
The value of the controlling expression in this 'if' statement is always non-zero. The control statement is therefore redundant. For example:
/*PRQA S 2017,3120,3227,3355,3358,3408 ++*/
void foo(int x)
{
if (x > 10)
{
if (x > 5) /* 2991 2995 */
{
}
}
}
MISRA-C:2004 Rules applicable to message 2991:
| Rule 13.7 (Required) | Boolean operations whose results are invariant shall not be permitted. |
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 |