Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2004-12.5

In this section:
Synopsis

(Required) The operands of a logical && or || shall be primary-expressions.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

The operands of a logical && or || is not an identifier, a constant, a parenthesized expression or a sequence of the same logical operator.

Coding standards

This check does not correspond to any coding standard rules.

Code examples

The following code example fails the check and will give a warning:

int main(void) {
  int a,b;
  if (a > 0 && !b);
}

The following code example passes the check and will not give a warning about this issue:

int main(void) {
  int a,b;
  if ((a > 0) && (!b));
}