To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

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

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

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

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.

Five days for fixing a two-character er…

Five days for fixing a two-character error, or a myth of almighty technologies aiding software development

Aug 30 2010

In this blog, you may often read posts about how this or that software tool or software development technology helps make fewer errors, find them faster and correct them easier. Surely this all is true but no one should ignore the main tool - brain, for nothing can replace it. Today I will speak about a program error that took us two characters and five days of work to fix it.

Once, after we released a new version of the PVS-Studio static code analyzer, a user addressed us with a complaint that our tool would not work on his complex project. By the way, it is a good means for developers to estimate how much a program is useful - if you receive several letters with messages that something is broken and does not work after you release a new version, it means that your program is needed. Let's return to the program. So, if it does not work, it means that it cannot find files for analysis. First we asked the user about the type of his project and plug-ins for Visual Studio he had installed on his computer. It turned out that the user had Intel C++ Compiler but it was not the reason. He also had CUDA installed but this was not the reason either. Yes, by the way, the check of the simple demo project worked well but the check of a new empty project blank did not.

We asked the user to send us this project blank. It was checked correctly on our computers. The matter was additionally complicated by the fact that integration tests, unit-tests, user interface tests and some other tests ran successfully in that version.

By the end of the fifth day, after another launch of a special debug version with printf's arranged throughout the code (yes, it is on the issue "printf vs trendy cool tools") we found out the following thing. Our analyzer generates special cmd-scripts to analyze files and these scripts contain this line:

cd e:\projects\mylib

i.e. transfer to the project's folder. It was right the new version (the previous version worked well on our user's computer) where we had greatly rewritten the mechanism of generating these scripts. The cd command has one specific feature - it does not transfer into a folder on a different disk unless you specify the "/d" option. That is, the correct way of writing this should look this way:

cd /d e:\projects\mylib

This key, "/d", had been in the previous version of the program but we missed it through an oversight in the new version while rewriting the code. Unfortunately, all the tests we ran were launched from the same system disk and that is why the cd command worked well without the "/d" option.

What is more, this error occurs only when you open the project to be checked through Visual Studio (File->Open...). If you open the project by choosing the sln-file, the error will not reveal itself since the working folder coincides with that specified in the command of the cd script when you open the project this way. That is why we could not recall the error for a long time.

As everyone knows, the joy you feel when finding a complicated error is darkened by the awareness of your own folly. It was the same thing with us - the programmer simply forgot about this switch when rewriting the code.

What conclusions can we draw from this story? They are trivial yet not less useful for beginner programmers:

  • If your program does not work on a user computer, you should not blame programs like CUDA or Intel C++ Compiler installed on it. Although sometimes it might be their fault as well.
  • Even if an application successfully passes five different types of tests, it does not matter that it works in the same way everywhere and every time.
  • No software tool can fully replace the human brain. Alas.
  • If users of your program are programmers themselves, lucky you are! What other users know the words "debug version", "dump" and so on?
Popular related articles
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…

Comments (0)

Next comments
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 →