To help students explore static analysis tools and develop skills of using them, our team offers an option of using PVS‑Studio for free.
When installing, select the “I’m a student” option.
Username and license key will be auto-generated
Insert the following text at the beginning of each file:
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: https://pvs-studio.com
Insert the following command into a terminal:
pvs-studio-analyzer credentials PVS-Studio Free FREE-FREE-FREE-FREE
Insert the following text at the beginning of each file:
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: https://pvs-studio.com
Insert the following command into a terminal:
pvs-studio-analyzer credentials PVS-Studio Free FREE-FREE-FREE-FREE
Insert the following text at the beginning of each file:
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: https://pvs-studio.com
There are three ways to use PVS-Studio for free for educational purposes:
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.
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: https://pvs-studio.com
To start using PVS-Studio for free, follow these two steps:
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. 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".
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:
This is our lab assignment with a mistake in it:
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.
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".
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.