V3036. Consider inspecting the expression. Probably the '-=' should be used here.


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:

int 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:

int size, delta;
...
size -= delta;

If the code is correct, you may type in an additional space between the characters '=' and '-' to remove the V3036 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 V3036 rule. For instance, the analyzer will not generate the warning if a programmer does not use spaces between variables and operators. Here 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 V3035 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
344
Collected Errors
12 970