Miscellaneous-DoNotMixLogicalOperatorsΒΆ
The logical operators && and || should not appear together in a full expression
Required inputs: IR
&& 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
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.