How to use PVS-Studio for Free

Andrey Karpov
Articles: 296

We want to help the software world improve the quality of their code, and get to know static analysis tools better. We are giving the opportunity to use PVS-Studio static code analyzer for free, for educational purposes, so that individual developers and enthusiastic teams could also fully use it.

Picture 1


The main customers of the PVS-Studio tool are the development departments of various companies. At the same time, we would also like to see individual developers as our clients. Unfortunately, our experimental product CppCat had no success. We don't know how we can build a successful business in the sphere of static analysis by selling individual licenses. This is why we still see PVS-Studio as a B2B solution.

I think, our failure with CppCat was predetermined. The world imposes its own laws and for example, the well-known Coverity tool is also aimed at corporate licenses. However, this does not mean that we should exclude other options of interacting with the world.

We were thinking for quite a long time about how to help small-size development teams, and how to start issuing academic licenses. At first glance, it seemed that the simplest way is to start giving away licenses to those who develop free software. Unfortunately, this solution does not seem to be the way to go.

We should clarify our point of view. However, you can skip this section and just move to the "Free PVS-Studio license" section. If you are still interested in knowing the details, then I suggest you continue reading.

Our thoughts behind this decision

Let's imagine an individual developer, who writes and sells some game, for example. His code is closed, and used for commercial purposes. Nevertheless, we would be glad to help him get acquainted with the methodology of static code analysis, and provide a free license for him. This is a sort of promotional step that could get compensated later. At this point this is an individual developer, but who knows what may happen in the future.

On the other hand, let's take a team of 50 people working in a large company, and creating a free open source project. They sit in an office, eat company cookies, have a fixed income, and position themselves as idealists in the sphere of open source development. Yes, they are making a free product, but the company gets the revenue from it by indirect means. For a number of reasons, it is beneficial for the company to keep this project open and free. It seems quite fair to us that such an organization should purchase a license in order to use the analyzer.

As you see, the criterion "a free program", or "open source code" doesn't suit us in making a decision. We would like to separate the projects being developed in a company, from projects of small-sized enthusiastic teams. We could do that solely by a license agreement, but in this case it's hard to distinguish between different types of projects. In addition, this will be of little help to us in terms of promotion. Let's be honest, big companies provide free licenses for the sake of advertisement. We are no worse and no better than others in doing the same.

The solution came quite naturally; What is the main difference between large corporate projects and the code of enthusiastic teams? Corporate projects have much less freedom, and more bureaucracy. It is unlikely that Microsoft's management would be pleased if a Microsoft Office developer wrote in the code that it is his personal project. We thought we could use this, and suggest making comments in the code, which would make reference to PVS-Studio. In addition, the code of open source projects would promote PVS-Studio.

Free PVS-Studio license

You need to go through two steps to start using the PVS-Studio code analyzer for free.

Step 1.

If you are using PVS-Studio as a Visual Studio plugin, enter the following license key:

Name: PVS-Studio Free


If you are using PVS-Studio for Linux, go to the second step, you don't need a license file.

Step 2.

Make edits in all the compilable files of your project. I.e. in all the files with the extensions c, cc, cpp, cs, and so on. You don't have to change header h-files.

You need to write two lines of comments in the beginning of each file. We offer several options. This is a kind of 'fee' for using PVS-Studio for free.

Comments for students (academic license):

// This is a personal academic project. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#:

Comments for free open source projects:

// This is an open source non-commercial project. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#:

Comments for individual developers:

// This is an independent project of an individual developer. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#:

Of course, the options we suggest won't be suitable for everyone. But that's the point of such measures. If none of the variants is relevant to you of your product, we suggest you consider purchasing the license.

A little note. Besides the described method of using the analyzer for free, you can still download a demo version of the analyzer to see the abilities. If you wish to get rid of the restrictions imposed by a demo version, you may just write to us.


If your project has a large number of files, then you can use an additional utility. You will need to specify the directory and the code to insert. Then it will recursively traverse all the files in the folder and subfolders, adding necessary comments to the code. You can download the utility (together with the source code) here: how-to-use-pvs-studio-free.


Some developers may say that they don't want to see two additional lines of code at the beginning of the file with the comments not related to the project itself. It is their right, and they may simply not use the tool. Or they can purchase a commercial license, and use it without any restrictions. We see these comments as a gratuity for the provided license, and also as an additional way to promote our product. I think it's a good, fair exchange.

At the same time, it solves the problem of distinguishing between corporate projects and private initiatives. If a project is made by enthusiasts, they have the full rights to do with the code anything they want, including adding such comments. If not, then there is some organization behind the project, and we would want to get a reward from it in the form of purchasing the license.

I hope our offer and position is clear. If you still have any questions, please contact us.

To convince your colleagues to start using PVS-Studio code analyzer, we suggest reading the following sections of our web-site.

Thank you for your attention. Let's make our software more reliable, and safer.


There was a large discussion on the topic whether it is permitted to add and remove comments in the source code so that to use the analyzer for free. We consider this method to be unacceptable, as it is a way to bypass the restrictions, imposed on a free license. Therefore, we decided to add the following section to the license agreement:

You have the right to use PVS-Studio for free by adding special comments to the source code of your project. To find out which comments should be added and the way to automate this process, read the article: "How to use PVS-Studio for Free".

Note that this mode is not intended to evaluate this software. Please use a demo version or request a temporary license key to try out the analyzer.

You should insert these comments when you have already decided to use the analyzer on a regular basis. You can remove these comments later, but it is possible to remove them only once.

It is not allowed to add and remove the comments in the source code repeatedly. It is also not allowed to append comments multiple times and subsequently roll back the content of comments in source files to initial state using version control system. Such actions are intended to evade the terms that the source code should contain comments and are a violation of the analyzer usage agreement.

Use PVS-Studio to search for bugs in C, C++ and C# code

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;

Andrey Karpov
Articles: 296

Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;