# V573. Use of uninitialized variable 'Foo'. 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;

This diagnostic is classified as:

CWE-457 CERT-EXP33-C CERT-EXP53-CPP

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