V589. The expression of the 'A =- B' kind is utilized. Consider reviewing it, as it is possible that 'A -= B' was meant.


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.

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-480.


Bugs Found

Checked Projects
334
Collected Errors
12 668