V573. Uninitialized variable 'Foo' was used. The variable was used to initialize itself.


The analyzer detected a potential error: a variable being declared is used to initialize itself. Let's consider a simple synthetic sample:

int X = X + 1;

The X variable will be initialized by a random value. Of course, this sample is farfetched yet it is simple and good to show the warning's meaning. In practice, such an error might occur in more complex expressions. Consider this sample:

void Class::Foo(const std::string &FileName)
{
  if (FileName.empty())
    return;
  std::string FullName = m_Dir + std::string("\\") + FullName;
  ...
}

Because of the misprint in the expression, it is the FullName name which is used instead of FileName. This is the correct code:

std::string FullName = m_Dir + std::string("\\") + FileName;

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

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


Bugs Found

Checked Projects
361
Collected Errors
13 417