![]() |
![]() |
3322 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Operations | |||||||
The logical negation operator '!' has been used with an operand which is a constant expression with a value other than 0 or 1. The ISO:C90 language does not support an explicit Boolean type, but there are certain operators which generate a result of type int with a value of 0 or 1. The result may be described as effectively Boolean. There are also operators which act on operands which are interpreted in a Boolean sense. The value of the operands are permitted to be of any value but are implicitly compared with 0. The result of the logical negation operator '!' is effectively Boolean. Its operand can be a value of any scalar type but it is interpreted as effectively Boolean. Message 3322 is generated if the operand is a constant value other than 0 or 1. For example:
/*PRQA S 3120,3211,3408 ++ */
int true = !0; /* No message */
int false = !1; /* No message */
int falser = !2; /* Message 3322 */
No MISRA C:2012 Rules applicable to message 3322
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 |