V6132. It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics.
The analyzer has detected a suspicious code fragment, which may be a forgotten or incorrectly commented else block.
This issue is best explained with examples.
if (!x)
t = x;
else
z = t;
In this case, code formatting does not meet its logic: the z = t
expression will execute only if (x == true)
, which is hardly what developers intended. A similar situation may occur when a code fragment is not commented properly:
if (!x)
t = x;
else
//t = -1;
z = t;
In this case, it is necessary to either fix the formatting by making it more readable or fix the logic error by adding a missing branch of the if
operator.
Sometimes, it is difficult to determine whether the code has issues or if the formatting is unusual. The analyzer attempts to minimize the number of false positives related to code formatting by not issuing warnings when the number of spaces and tabs differs before the else
keyword and the expression following it.
This diagnostic is classified as: