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.

Note about diagnostics fine-tuning

Note about diagnostics fine-tuning

Dec 15 2014

Despite the fact that our analyzer is stated to be one of the simplest tools in installing and everyday usage (everything is working "out-of-the-box" and does not require any unintuitive tweaks), some users lacks flexibility of some of the diagnostic rules. Unfortunately, usability and flexibility is if not totally opposite, but sometimes those features conflict with each other. In this note, we shall be talking about additional mechanism of tuning some diagnostic rules, which can be useful for some of our valuable users.


It was already possible to manipulate the behavior of a few diagnostic rules using special comments. You can read about it from their description in documentation. For instance, //-V610_LEFT_SIGN_OFF for V610 rule.

However, all these settings was about false alarm suppression. New settings now allows users to hint analyzer where additional errors may be found.

New settings syntax

Syntax of new mechanism is as follows: to activate addition to diagnostic, user should use //+V comment. We have chosen this format because it is similar to the widely used comment to false alarm suppression: //+V. New format to make an addition to diagnostic is simple:

//+V<Number of rule>, <Key>:<Value>, ... , <Key>:<Value>

User can arrange parameters in any order in relation to each other. In a few diagnostics, there may be a possibility to add values with the same key, but with different values. In almost any diagnostic, some parameters in addition may be absent.

User may write an addition in:

  • The file that is included in the whole project (stdafx.h),
  • If they are related to some function or class method - near its prototype or realization in .h-file,
  • If addition should be related only to particular .cpp-file - anywhere inside it.

Restriction - user should write the rule in one line.




At the time when article was written, we have implemented new additions for two diagnostic rules: V128 and V576. In future, there may be new additions to other rules.

V128 tweaking

V128 rule finds all the places where variable of memsize type is written into file or is read from file. Full description of rule is present in the link above. One user asked to extend V128 with addition of possibility of creating a warning on custom functions.

Addition format is as follows: just above function prototype (or near its realization, or in standard header file) user should add a special comment. Let us start with the usage example:

//+V128, function:write, non_memsize:2
void write(string name, char);
void write(string name, int32);
void write(string name, int64);
  write("zz", array.size()); // warning V128


  • "function" key represents name of the function to be checked by analyzer. This key is necessary - without this key addition, of course, would not work.
  • "class" key - non-necessary key that allows to enter class name to which this function belongs (i.e. class method). Without specifying it analyzer will check any function with given name, with specifying - only ones that belongs to the particular class.
  • "namespace" key - non-necessary key that allows to enter namespace name to which function belongs. Again, without specifying it analyzer will check any function with given name, with specifying - only ones that belongs to the particular namespace. Key will correctly work with the "class" key - analyzer then will check any class method with given name that belongs to particular namespace.
  • "non_memsize" key allows specifying number of argument that should not allow type, which size changes depending on architecture. Number counts from one, not from zero. There is a technical restriction - this number should not exceed 14. There may be multiple "non-memsize" keys if there is a need to check multiple function arguments.

Warning level in case of user functions is always first.

At last, here is full usage example:

//Warns when in method C of class B
//from A namespace memsize-type value
//is put as a second or third argument.

V576 tweaking

V576 rule finds all the places where argument in printf()-like function is not corresponding with its desired type in format string. Potential user asked us to extend this diagnostic rule to the case of user-defined functions. He suggested that analyzer would print a warning message in case of somewhere an argument does not correspond with format string. It is assumed that formatting principle is equal to the one in printf() function.

Again, no sooner said than done.

Addition format is alike to the one of V128 diagnostics. User should write a comment of special kind near function prototype (or near its implementation, or in standard header file). Again, let us start with the usage example:

//+V576, function:Mylog, format_arg:1, ellipsis_arg:2
Mylog("%f", time(NULL)); // warning V576


  • "function", "class" and "namespace" keys determines function name, class name (if it's required to analyze only methods of some class) and namespace name (if it's required to analyze only functions or class members of some namespace).
  • "format_arg" key determines number of function argument that contains format string. This argument is necessary. Numbers counts from one, not from zero, and should not exceed 14.
  • "ellipsis_arg" key determines number of function argument with ellipsis (three dots). This number is bound by the same restrictions as the one given by format_arg key. In addition, ellipsis_arg number should be greater than format_arg (because ellipsis can only be the last argument). This key is also nessesary.

At last, here is full usage example:

//Warn when in C method of class B from A namespace
//arguments, counting from third one, does not
//correspond to the format line in the second argument 


Our tool is constantly improving; it always gains new possibilities and other decisions features. I hope we also stressed that we love our clients and value their wishes. On PVS-Studio license purchase, you will also gain qualified support and realization of features that will allow you to gain maximum profit from static code analysis.

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…
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…
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…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
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…
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…
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…
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…
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…

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 →