V3017. A pattern was detected: A || (A && ...). The expression is excessive or contains a logical error.

The analyzer has detected an expression that can be reduced. Such redundancy may be a sign of a logical error. Consider this example:

bool firstCond, secondCod, thirdCond;
if (firstCond || (firstCond && thirdCond))

This expression is redundant. If 'firstCond == true', the condition will always be true regardless of what value the 'thirdCond' variable refers to; and if 'firstCond == false', the condition will always be false – again, irrespective of the 'thirdCond' variable.

Perhaps the programmer made a mistake and wrote a wrong variable in the second subexpression. Then the correct version of this code should look like this:

if (firstCond || (secondCod && thirdCond))

You can look at examples of errors detected by the V3017 diagnostic.

Bugs Found

Checked Projects
Collected Errors
14 072
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →