2. About Me:
George Gribkov
A C++ developer and developer of the PVS-
Studio static code analyzer.
I write articles on finding bugs in games
(Vangers, VVVVVV) and other open-source
projects.
gribkov@viva64.com
2
14. PVS-Studio warns: V501 There are identical sub-expressions
'Position.Y >= Control.Center.Y — BoxSize.Y * 0.5f' to the left and to
the right of the '&&' operator.
Unreal Engine 4 (C++)
14
24. PVS-Studio warns:
V709 Suspicious
comparison found:
'f0 == f1 ==
m_fractureBodies.size()’.
Remember that
'a == b == c’
is not equal to
'a == b && b == c'.
Bullet –Red Dead Redemption’s Engine (C++)
24
27. PVS-Studio warns: V502 Perhaps the '?:' operator works in a
different way than it was expected. The '?:' operator has a lower
priority than the '+' operator.
CryEngine (C++)
27
29. PVS-Studio warns: V502 Perhaps the '?:' operator works in a
different way than it was expected. The '?:' operator has a
lower priority than the '-' operator.
Amazon Lumberyard (C++)
29
59. Errors are fixed the moment they appear
Many errors are fixed before testing and do not
get to that stage
Those that made it are detected at night
Recap
59
61. Errors are fixed the moment they appear
Many errors are fixed before testing and do not
get to that stage
Those that made it are detected at night
The cost to fix bugs is almost zero
Recap
61
62. Of course! Static analysis does not find all bugs
Static analysis – is an answer to the "how else can I improve code
quality?" question
An example of a great combination: static + dynamic analysis
Should You Use Other Approaches?
62
64. Everyone makes mistakes. Even experts.
This is normal, you can use special tools to
fix them.
Conclusion
64
65. Typical error patterns:
Copy-pasting and the last line effect
Using an incorrect address
Errors in conditional operators
Operation precedence issues
Elusive typos
Conclusion
65
66. You can save a lot of resources, if you set up
continuous static analysis
Conclusion
66
67. 67
Use this QR code to get a one-
month PVS-Studio free trial
68. 68
Use this QR code to get a one-
month PVS-Studio free trial
Q&A