![]() |
![]() |
4116 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Operands | REFERENCE - ISO:C90-6.3.3.3 Unary Arithmetic Operators | ||||||
The operand of this logical negation 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 QA·C. 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 int flag;
extern void foo(void)
{
if (!flag) {} /* Message 4116 - operand is not Boolean */
if (!(flag != 0)) { } /* Operand is Boolean, but expression is clumsy */
if (flag == 0) { } /* Explicit and readable */
return;
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |