Examples of errors detected by the V573 diagnostic.


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


Multi Theft Auto

V573 Uninitialized variable 'base' was used. The variable was used to initialize itself. ceguiwindow.cpp 1858


Vector2 Window::windowToScreen(const UVector2& vec) const
{
  Vector2 base = d_parent ?
    d_parent->windowToScreen(base) + getAbsolutePosition() :
    getAbsolutePosition();
  ....
}

Similar errors can be found in some other places:

  • V573 Uninitialized variable 'base' was used. The variable was used to initialize itself. ceguiwindow.cpp 1892

Firebird

V573 Uninitialized variable 'p' was used. The variable was used to initialize itself. restore.cpp 17535


void realign(....)
{
  for (....)
  {
    UCHAR* p = buffer + field->fld_offset;
    ....
    for (const burp_fld* field = relation->rel_fields;
         field; field = field->fld_next)
    {
      ....
      UCHAR* p = buffer + FB_ALIGN(p - buffer, sizeof(SSHORT));
  ........
}

Similar errors can be found in some other places:

  • V573 Uninitialized variable 'q' was used. The variable was used to initialize itself. restore.cpp 17536

Word for Windows 1.1a

V573 Uninitialized variable 'sectLast' was used. The variable was used to initialize itself. print2.c 599


FPrintSummaryInfo(doc, cpFirst, cpLim)
int doc;
CP cpFirst, cpLim;
{
  int fRet = fFalse;
  int pgnFirst = vpgnFirst;
  int pgnLast = vpgnLast;
  int sectFirst = vsectFirst;
  int sectLast = sectLast;
  ....
}

This is what should have been written here: int sectLast = vsectLast;

Similar errors can be found in some other places:

  • V573 Uninitialized variable 'sectLast' was used. The variable was used to initialize itself. print2.c 719

Clang

V573 Uninitialized variable 'BytesToDrop' was used. The variable was used to initialize itself. typerecordmapping.cpp 73


static Error mapNameAndUniqueName(....) {
  ....
  size_t BytesLeft = IO.maxFieldLength();
  if (HasUniqueName) {
    .....
    if (BytesNeeded > BytesLeft) {
      size_t BytesToDrop = (BytesNeeded - BytesLeft);
      size_t DropN = std::min(N.size(), BytesToDrop / 2);
      size_t DropU = std::min(U.size(), BytesToDrop - DropN);
      ....
    }
  } else {
    size_t BytesNeeded = Name.size() + 1;
    StringRef N = Name;
    if (BytesNeeded > BytesLeft) {
      size_t BytesToDrop = std::min(N.size(), BytesToDrop); // <=
      N = N.drop_back(BytesToDrop);
    }
    error(IO.mapStringZ(N));
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show