Free PVS-Studio for Students and Teachers

To help students explore static analysis tools and develop skills of using them, our team offers an option of using PVS-Studio for free.

There are three ways to use PVS-Studio for free for educational purposes:

  • Adding special comments to source code;
  • Using the Compiler Explorer website;
  • Free version for open-source projects.

None of these options requires contacting us to get a trial key. You simply download the distribution and follow the instructions below.

Let's find out when and how to use each option.

Adding special comments to source code

When working on an academic project that includes a number of source files, the most convenient way to use the analyzer is to add a special comment to those files:

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

// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

To start using PVS-Studio for free, follow these two steps:

Step 1

If you are using PVS-Studio as a plugin for Visual Studio / IntelliJ IDEA / Rider, enter this license key:

Name: PVS-Studio Free

Key: FREE-FREE-FREE-FREE

If you are using a command-line version of PVS-Studio, go straight to Step 2 – you won't need a license file.

Step 2

Add the two comment lines described above to the beginning of each compiling file – i.e. files whose extensions are c, cc, cpp, cs, java, and so on. You don't have to modify the header (h) files.

You can add comments either manually or using a special utility, which can be downloaded (along with the source code) here: how-to-use-pvs-studio-free.

This scenario is described in more detail in the article "For professors' note: use PVS-Studio to get students familiar with code analysis tools".

Using the Compiler Explorer website

You may find it convenient to do your lab assignments that consist of one file using the Compiler Explorer (godbolt.org) website. This is an online tool that allows you to type, compile, and run programs written in Ada, C, C++, D, Fortran, Go, Pascal, Rust, and other programming languages. You can have Compiler Explorer generate a link to your code and submit it to your teacher for assessment, which makes it especially convenient to use.

If your code is written in C or C++, you can additionally check your program with PVS-Studio right there on Compiler Explorer and thus get hands-on experience of how the analyzer works.

Suppose you have a lab task on loops in C++ and you are to write an array-sorting program. Let's make a mistake in it and see how the Compiler Explorer + PVS-Studio combination works:

https://import.viva64.com/docx/pages-docx/for-students/image1.png

This is our lab assignment with a mistake in it:

  • Editor window;
  • Resulting assembly code, which we aren't interested in right now;
  • Program's seemingly correct output;
  • Warnings by PVS-Studio.

The array seems to be sorted correctly, so the program looks correct too. But that's just luck. Actually, we are indexing out of the array's bounds, which is what PVS-Studio is warning us about. Let's take a closer look at the condition of the inner loop:

j < size + 1

This is what it should actually look like:

j < size

Now you can correct the mistake and send your teacher a link for assessment: correctly done lab assignment.

Free version for open-source projects

Developers co-working on an open-source academic project can get free licenses. To learn more about this option, see the article "Ways to Get a Free PVS-Studio License".

A note for corporate users

None of the above-discussed scenarios of using PVS-Studio for free is meant to be used as a means of trying out the tool on a commercial project. This would be simply impossible or at least inconvenient.

Just contact us for a trial key and specify your corporate email address. This will help us figure out if we have already had a conversation with your co-workers before, if your company is or was our customer, and so on. If necessary, we can advise you on using the analyzer or provide an Enterprise License if you want to integrate PVS-Studio with, say, SonarQube.


Bugs Found

Checked Projects
409
Collected Errors
14 072
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 →
Accept