V3004. 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);
This diagnostic is classified as:
You can look at examples of errors detected by the V3004 diagnostic. |