>
>
>
V589. Expression of the 'A =- B' kind i…


V589. Expression of the 'A =- B' kind is used. Possibly meant: 'A -= B'. Consider inspecting the expression.

The analyzer detected a potential error: there is a sequence of '=-' characters in code. It might be a misprint and you should use the '-=' operator.

Consider this sample:

size_t size, delta;
...
size =- delta;

This code may be correct, but it is highly probable that there is a misprint and the programmer actually intended to use the '-=' operator. This is the fixed code:

size_t size, delta;
...
size -= delta;

If the code is correct, you may type in an additional space between the characters '=' and '-' to remove the V589 warning. This is an example of correct code where the warning is not generated:

size = -delta;

To make false reports fewer, there are some specific exceptions to the V589 rule. For instance, the analyzer will not generate the warning if a programmer does not use spaces between variables and operators. Here you are some samples of code the analyzer considers safe:

A=-B;
int Z =- 1;
N =- N;

Note. To search for misprints of the 'A =+ B' type, the V588 diagnostic check is used.

This diagnostic is classified as: