![]() |
|
MISRA-C:2004 Rule 13.2: (Advisory) |
|
||||
![]() | |||||||
For example, if x is an integer, then:
if(x!=0)/* Correct way of testing x is non-zero */if(y)/* Not compliant, unless y is effectively Boolean data (e.g. a flag) */
QAC messages that encompass this guideline:
| 3344 | Controlling expression is not an 'essentially Boolean' expression. |
| 4528 | An expression of 'essentially enum' type (%1s) is being used as the %2s operand of this logical operator (%3s). |
| 4529 | An expression of 'essentially enum' type (%1s) is being used as the first operand of this conditional operator (%2s). |
| 4538 | An expression of 'essentially signed' type (%1s) is being used as the %2s operand of this logical operator (%3s). |
| 4539 | An expression of 'essentially signed' type (%1s) is being used as the first operand of this conditional operator (%2s). |
| 4548 | A non-negative constant expression of 'essentially signed' type (%1s) is being used as the %2s operand of this logical operator (%3s). |
| 4549 | A non-negative constant expression of 'essentially signed' type (%1s) is being used as the first operand of this conditional operator (%2s). |
| 4558 | An expression of 'essentially unsigned' type (%1s) is being used as the %2s operand of this logical operator (%3s). |
| 4559 | An expression of 'essentially unsigned' type (%1s) is being used as the first operand of this conditional operator (%2s). |
| 4568 | An expression of 'essentially floating' type (%1s) is being used as the %2s operand of this logical operator (%3s). |
| 4569 | An expression of 'essentially floating' type (%1s) is being used as the first operand of this conditional operator (%2s). |
|
||
(c) The Motor Industry Research Association, 2004
|
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2 © 2013 Programming Research www.programmingresearch.com |
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |