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;


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++, and C#

goto PVS-Studio;