>
>
>
V6085. An abnormality within similar co…


V6085. An abnormality within similar comparisons. It is possible that a typo is present inside the expression.

The analyzer found suspicious condition that may contain an error of copy-paste.

The diagnosis is empirical, that is why it is easier to demonstrate it on the example than to explain the working principle of the analyzer. Consider this example:

if (m_a != a || 
    m_b != b || 
    m_b != c) // <=
{
  ....
}

Because of the similarity of the variable names, there is a typo in the code. An error is located on the third line. The variable 'c' should be compared with 'm_c' rather than with 'm_b'. It is difficult to notice the error even when reading this text. Please, pay attention to the variable names.

The right variant:

if (m_a != a || 
    m_b != b || 
    m_c != c)
{
  ....
}

If the analyzer issued the warning V6085, then carefully read the corresponding code. Sometimes it is difficult to notice a typo.

This diagnostic is classified as: