Miscellaneous-DoNotMixLogicalOperatorsΒΆ

The logical operators && and || should not appear together in a full expression

Required inputs: IR

The two logical operators && and || should not be used together in a single expression even if parentheses disambiguate precedence. Such expressions should be split into smaller pieces.
Example
if ((b && c) || a) {} // bad
if (!(!b || !c) || a) {} // ok, but not recommended
d = b && c;
if (d || a) {} // better

Possible Messages

Key

Text

Severity

Disabled

mixed_logical_operators

Full expression contains both && and ||

None

False

Options