How to use PVS-Studio for free

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.

Introduction

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 or you are using the “C and C++ Compiler Monitoring UI” (Standalone.exe) utility, enter the following license key:

Name: PVS-Studio Free

Key: FREE-FREE-FREE-FREE

If you are using PVS-Studio for Linux/macOS, use the following command:

pvs-studio-analyzer credentials PVS-Studio Free FREE-FREE-FREE-FREE

Note. Previously, a comment was enough to activate the free license for the Linux version. Now you also need to enter this special key, because without it, some scenarios for using the analyzer turned out to be inconvenient. Read more.

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#: http://www.viva64.com

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#: http://www.viva64.com

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#: http://www.viva64.com

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.

Automation

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.

Conclusion

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.

By Andrey Karpov

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Unicorn Developer

The developer, the debugger, the unicorn. I know all about static analysis and how to find bugs and errors in C, C++, C#, and Java source code.