V700. Consider inspecting the 'T foo = foo = x;' expression. It is odd that variable is initialized through itself.

The analyzer has detected an expression of the 'T foo = foo = X' pattern. The variable being initialized is itself taking part in the assignment. Unlike the issue diagnosed by the V593 rule, the foo variable here is initialized by an X expression; however, this code is very suspicious: the programmer should have most likely meant something else.

Here is an example of incorrect code:

int a = a = 3;

It's hard to say for sure what was actually meant here. Probably the correct code should look as follows:

int a = 3;

It is also possible that the programmer wanted to initialize the variable through assigning a value to another variable:

int a = b = 3;

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

You can look at examples of errors detected by the V700 diagnostic.


Bugs Found

Checked Projects
409
Collected Errors
14 072
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept