![]() |
![]() |
2995 | ![]() |
||||
![]() | |||||||
| Invariant operations | |||||||
The result of this logical operation is always 'true' (1). The fact that the operation is "degenerate" suggests a logical flaw in the code. For example:
/*PRQA S 2017,2100,3120,2982,2983,2984,2986,3198,3199,3203,3227,3355,3408 ++*/
void foo(unsigned char x, int y)
{
int r;
r = x < 300; /* 2995 */
if (y < 20)
{
r = y < 30; /* 2995 */
}
}
MISRA-C:2004 Rules applicable to message 2995:
| 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 |