V6004. The 'then' statement is equivalent to the 'else' statement.


The analyzer has detected a suspicious code fragment with an 'if' statement whose both true- and false-statements are absolutely identical. It is often a sign of an error.

For example:

if (condition)
  result = FirstFunc(val);
else
  result = FirstFunc(val);

Regardless of the variable's value, the same actions will be performed. This code is obviously incorrect and should have looked something like this:

if (condition)
  result = FirstFunc(val);
else
  result = SecondFunc(val);

Bugs Found

Checked Projects
367
Collected Errors
13 552