![]() |
![]() |
4115 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Operands | REFERENCE - ISO:C90-6.3.13 Logical AND Operator, ISO:C90-6.3.14 Logical OR Operator | ||||||
An operand of this logical && or logical || operator is not an effectively Boolean expression. The ISO;C90 language does not support an explicitly Boolean type. Type _Bool was introduced in ISO:C99 but is not recognised in the current version of QAC. In both versions of the language, there exist a number of operators which always yield a value of either 0 or 1 which is of type int. These operators are:
/*PRQA S 1278,2017,2213,3120,3198,3199,3203,3408,3447 ++*/
extern unsigned int ui;
extern unsigned int uj;
extern void foo(void)
{
if ((ui != 0U) && (uj > 0U)) { } /* */
if ((ui > 10U) || uj) { } /* Message 4115 */
return;
}
MISRA-C:2004 Rules applicable to message 4115:
| Rule 12.6 (Advisory) | The operands of logical operators (&&, || and !) should be effectively Boolean. Expressions that are effectively Boolean should not be used as operands to operators other than (&&, ||, !, =, ==, != and ?:). |
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 |