Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V7001. Operands of a binary operator...
menu mobile close menu
Additional information
toggle menu Contents

V7001. Operands of a binary operator are equivalent.

Apr 03 2026

The analyzer has detected a code fragment that may contain a logical error: operands of an operator are equivalent.

The example:

if (a != 0 && a != 0)

In this case, the identical expressions a != 0 surround the && operator, which indicates an unintended error. Most likely, another variable should be checked:

if (a != 0 && b != 0)

The second check may also be redundant.

The diagnostic rule also considers non-identical but equivalent expressions.

The example:

if ((a * b) > (b * a))

The analyzer reports a warning because multiplication is commutative, and the expressions will evaluate to the same result.