&&
, and ||
) CXX-W1066Having side-effects in a logical operator's right-hand operand can be harmful as they may or may not be executed. This can lead to unintended bugs in code. Consider using if-else statements to make conditional execution clearer.
int x = 10;
bool y = x > 10 || --x == 9; // here --x is a conditional execution
int x = 10;
bool y = false;
if (x > 10) {
y = true;
} else {
--x; // conditional execution is clear
y = true;
}