V681. The language standard does not define an order in which the 'Foo' functions will be called during evaluation of arguments.

The analyzer has detected a potential error in a sequence of function calls.

According to the C++ standard, the order of calculating a function's actual arguments is not determined. In the expression 'A(B(), C())', you can't tell for sure which of the two functions 'B()' and 'C()' will be called first - it depends on the compiler, compilation parameters, and so on.

This may cause troubles on rare occasions. The analyzer warns you about code fragments that look most strange. Unfortunately, we had to deliberately limit the number of occasions this warning is generated to avoid too many false positives. You see, actual arguments are too often represented by calls of other functions, which is in most cases absolutely safe.

Here's an example of code PVS-Studio will warn you about:

Point ReadPoint()
  return Point(ReadFixed(), ReadFixed());

This code may cause the X and Y values to be swapped, since it is not known which of the two will be calculated first.

This is the fixed code:

Point ReadPoint()
  float x = ReadFixed();
  return Point(x, ReadFixed());

This diagnostic is classified as:

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

Bugs Found

Checked Projects
Collected Errors
14 429
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 →