Our website uses cookies to enhance your browsing experience.
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

Myths about static analysis. The second…

Myths about static analysis. The second myth - expert developers do not make silly mistakes

Nov 02 2011

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things.

The second myth is: "Expert developers do not make silly mistakes that are mostly caught by static code analyzers".

This is how this statement looks in discussions on forums (this is a collective image):

I, a skilled developer, haven't had any problems with memory spoiling, object lifetime, etc. for N years. Static analysis is a tool for "McDonald's", and here (on a professional forum) there are only geeks. Now I mostly face problems with difficult-to-test algorithms and integration with other developers using implicit contracts on object states.

It sounds as if typos and inattentive mistakes were solely the work of amateurs. Professional developers have not made them for a long time and now mostly deal with such complex errors like synchronization issues or complex data processing algorithms.

It is not so. All the programmers make silly mistakes. I know that you haven't heard me, so I repeat this heretical thought once again: all the programmers make silly mistakes. It doesn't matter how skillful they are. To err is human. Errors they make are most often very simple.

Programmers take my statement about errors with great unfriendliness. In their opinion, they are those who haven't made such mistakes for many years. I think it is the effect of an interesting aspect of our psyche that sifts memories about unpleasant moments of the programming practice.

Let's digress from our subject a bit and recall why various horoscopes are so enduring. The first reason is very vague formulas that one can easily apply to oneself. But we are interested in the second point: people do not remember cases when a prophecy didn't come true. But they do remember and tell the others about those cases when some situation in their life coincided with one described in a horoscope. So it turns out that when we speak about and recall horoscopes, we find N evidences that they work and do not remember about N*10 cases when they did not work.

Something like that happens to a programmer when searching for errors in code. You remember complex and interesting errors very well and can discuss them with your colleagues or write a blog-post about them. But when you notice that you have written 'BA' variable instead of 'AB', you will simply fix the bug and the fact will slip from your memory. Freud noticed one peculiarity of our memory: one tends to remember positive statements about oneself and forget negative statements. If a person fights a complex error in an algorithmic task, when he finally fixes it, he considers himself a hero: this fact is worthy remembering and even telling the others. But when a programmer finds a silly bug, there is no reason and wish to remember it.

What proofs do I have? Although most misprints and bugs get fixed finally, some of them remain unnoticed in programs. A lot of examples of these you may find in this article. You will see that it were not novices who made the mistakes cited in the article, but skilled programmers.

The conclusion is: programmers spend much more time on fixing misprints than they think. Static analysis tools can help to significantly save developers' efforts, detecting some of these errors before the testing stage.

Popular related articles
Under the hood of SAST: how code analysis tools look for security flaws

Date: Jan 26 2023

Author: Sergey Vasiliev

Here we'll discuss how SAST solutions find security flaws. I'll tell you about different and complementary approaches to detecting potential vulnerabilities, explain why each of them is necessary...
Intermodular analysis of C and C++ projects in detail. Part 2

Date: Jul 14 2022

Author: Oleg Lisiy

In part 1 we discussed the basics of C and C++ projects compiling. We also talked over linking and optimizations. In part 2 we are going to delve deeper into intermodular analysis and discuss its...
Intermodular analysis of C and C++ projects in detail. Part 1

Date: Jul 08 2022

Author: Oleg Lisiy

Starting from PVS-Studio 7.14, the C and C++ analyzer has been supporting intermodular analysis. In this two-part article, we'll describe how similar mechanisms are arranged in compilers and reveal...
How to introduce a static code analyzer in a legacy project and not to discourage the team

Date: Jun 20 2020

Author: Andrey Karpov

It is easy to try a static code analyzer. But it requires skills to introduce it in the development of an old large project. If the approach is incorrect, the analyzer can add work, slow down...
A note of caution about using PVS-Studio on godbolt.org (Compiler Explorer)

Date: Jun 08 2020

Author: Andrey Karpov

We have added an option allowing you to experiment with the PVS-Studio static analyzer on the godbolt.org (Compiler Explorer) website. It supports analysis of C and C++ code. We believe this to be an…

Comments (0)

Next comments next comments
close comment form