⬆️ ⬇️

PVS-Studio: reviews

I decided to collect reviews of various people in one place concerning our static code analyzer PVS-Studio. Some reviews are given in full, others partially. You can get acquainted with the original reviews by clicking on the appropriate links.





A few words about PVS-Studio, if you still do not know what it is



PVS-Studio is a tool for programmers using C / C ++ / C ++ 11 programming languages. The tool is a static code analyzer that detects errors and other shortcomings in the source code of programs. The analyzer is focused on developers of Windows applications. At the moment, PVS-Studio is integrated into the Visual Studio 2005/2008/2010 environment, and will also soon support VS 2012. It is possible to test projects collected using MinGW. More information about the analyzer can be found at the link: http://www.viva64.com/ru/pvs-studio/



Now we offer to explore some of the feedback we have gained.

')

About checking our open-source projects



Posted by: John Carmack .



Source: Twitter post (EN).



It's great when static code analysis tools use a set of open source applications to demonstrate their capabilities: http://www.viva64.com/en/a/0079/



John Carmack on the experience of using PVS-Studio



Posted by: John Carmack .



Source: quote from the article " Static Code Analysis " (EN).



The next tool I learned was PVS-Studio . It is easily integrated into Visual Studio and has a convenient demo mode (be sure to try it!). If you compare it with / analyze, PVS-Studio is painfully slow, but it still revealed several additional critical errors even in the code that has already been completely cleaned from the point of view / analyze. In addition to detecting defects that are errors from a logical point of view, the tool is also able to find a number of problems related to common programmer errors, even if the code is written quite adequately. It is almost guaranteed that you will receive some false warnings, but, damn it, because even such general flaws sometimes need to be corrected.



A number of good articles are collected on the PVS-Studio website , most of them contain examples from proven open source projects that demonstrate specific types of errors that the tool can find. I thought about adding some illustrative warnings issued by static analyzers to this article, but it turned out that you can find more detailed examples in the PVS-Studio materials. So I advise you to look at them, and do not smile smugly and think: “I would never write!”



PVS-Studio can find many interesting things in programs



Posted by: MetaQuotes



Source: comment on the article (RU).



This is a very good analyzer that works perfectly with the new mode of searching for errors.



For example, you have been methodically cleaning your projects with Lint + Visual Lint + your tools for many years, and then launch PVS-Studio.



You think that everything is already cleaned. But as a result, you see in your projects (millions of lines of C ++ code) stupid errors copy-paste, identical branches of conditions and a number of mechanical errors. A couple of days of work and the project gets rid of the next crowd of errors.



Personally, we will not enjoy PVS-Studio - this is a great addition to Lint and Intel Parallel Studio (all licensed).



We must support such companies - a review from the heart.



Background incremental analysis is great



Author: Sergey Vlasov



Source: quote from the article " Review of the PVS-Studio static code analyzer for Visual Studio " (EN).



In general, PVS-Studio showed that it can find non-trivial errors with a fairly small number of false positives (for example, Visual Studio gave me more than 200 warnings). The analysis procedure is very slow, but the presence of background incremental analysis, which allows you to check only the modified files after each build, partly compensates for this drawback. Integration with Visual Studio is very easy and very convenient.



Comparing PVS-Studio with PC-Lint and Klocwork



Author: Alexander Lotohov



Source: quotes from the article " Another testing of PVS-Studio " (RU).



PVS-Studio seems to be focused exclusively on working with Visual Studio. After installation, it is automatically integrated into the installed version of the studio. This completes all the necessary integration steps. It remains to launch the studio itself - and in it there will already be a new menu item of PVS-Studio. Such transparent integration is beyond praise!



...



Output of the analysis results is in a separate tab of PVS-Studio. Everything has been done quite comfortably: for each found (potential) problem, a description is displayed, a place (file and string), and a link to a detailed description of problems of this type: why it’s a problem, how it can be fixed, etc. The descriptions are made in great detail and with high quality!



...



And finally, a brief comparison of PVS-Studio with PC-Lint and Klocwork.



PVS-Studio is much more convenient to use than PC-Lint. The main problem of PC-Lint is too many potential problems, on the same project with default settings it gives out more than 23 thousand messages! (PVS-Studio - only 42). At the same time, PC-Lint cannot hide recurring problems (if the same .h file is connected from two .c files, PC-Lint will show the problem in the .h file twice, and PVS-Studio only once). And in PC-Lint, it is impossible to mark a separately taken problem as false positive, you can only “turn off” the entire class of problems.



Moreover, if you delve into the grief of the “garbage” issued by PC-Lint, you can find there more real potential problems than PVS-Studio finds (which, for example, did not find the absence of virtual destructors in a couple of classes, as well as the absence of clearly defined copy constructors and default constructors). Another thing is that in PC-Lint, these useful nuggets usually “sink” among the other, not so critical messages.



At the same time, PC-Lint is more versatile, although much more complicated to use, although its integration into Visual Studio is also quite simple.



But in general, here PVS-Studio is the undisputed leader. For it is possible to simply start working with it, which cannot be said about PC-Lint, where it can easily take a couple of days just to see all the messages issued!



But compared to Klocwork, PVS-Studio, alas, loses. First of all, for ease of use (I’ll only note state tracking from build to build - how many problems were fixed, how many were left and how many were added, as well as convenient reports), universality and better finding of critical potential problems. In addition, Klocwork is a server-based multi-user system, with the ability to assign those responsible for each problem found and work with several projects at once, easily tracking the status of each.



If you compare prices, you’ll get the following layout (information from the developer’s sites):



Well, the price roughly corresponds to the functionality, PVS-Studio is somewhere in the middle between cheap, but heavy and inconvenient to use PC-Lint and convenient and beautiful, but expensive Klocwork.



We have interesting materials on the site



Posted by: justinvh



Source: comment on reddit.com (EN).



Honestly, I was amazed at how interesting the PVS-Studio tool was. In addition, the accompanying materials are written clearly and clearly. The tool is worth it to at least familiarize yourself with it and get an idea of ​​its capabilities. Usually I used a static clang analyzer to deal with small errors, but PVS-Studio definitely showed itself worthy in the field of 64 bits.



In addition, it was fun to read a collection of 64-bit lessons .



I use it when porting Doom3 and it is really very cool. The developers provide good support to students, so if you want to give a lecture at the university on the topic of comparing static analyzers (as was the case in my case) or just want to learn more about their product, write them by e-mail and ask everything you need.



From time to time there were some oddities, but at least it was very interesting to look at the tool in action; It's a pity that I had to run it on a virtual machine every time, but the fact that it easily integrates with Visual Studio is very cool. At the moment I am using clang as a preprocessor, and all this also works very quickly.



As Carmack said , you will definitely find bugs.



Using PVS-Studio, it is easy to master the static code analysis technique.



Posted by: Anteru



Source: quote from the article " Review: PVS Studio " (EN).



If you are new to static analysis, I recommend you to try PVS-Studio (they have a trial version ). Static analysis of C ++ code is still at an early stage of development, but already now a tool like PVS-Studio can help you find hidden errors. Especially if your source code database has not yet been tested by unit tests, the static analyzer will quickly tell you which code fragments in your database should be viewed.



And yes, until I forgot: the tool is updated regularly, and the support works well - so, I reported an error at the very beginning of the review, and it was fixed in a couple of days.



Thanks again to the Viva64 team for providing me with a copy of the analyzer for review, keep up the good work as well!



PVS-Studio is useful when mastering 64-bit platforms



Author: Alex Chachanashvili



Source: quotation from the article " Checking code with PVS-Studio " (EN).



I liked the tool as a whole - it did find some noncritical problems in the server code, but to be honest, I ran most of my code through FlexeLint and BoundChecker (until the license expired). I also ran Visual Studio at 4 warning levels for checking debug builds, and it finds a lot of defects.



The main merit of PVS-Studio is that it is good at catching defects that affect the transfer of 32-bit code to 64-bit platforms.



We are great



By: Fernando Moreira



Source: Presentation Comment (EN).



Yeah, I really tried it and immediately became a fan :) Now I recommend it to every developer in our lab. The tool seamlessly integrates with VS and it is really able to teach developers important things, drawing attention to certain types of unknown problems / traps.



Until now, I have not received a single false warning, and this is great!



You guys are doing a serious business!



About PVS-Studio and Coverity advertising



Posted by: nomarketingbs



Source: I will insert the article “ How to Not Present Static Analysis Results ” (EN) as I don’t know what to select in it.



In addition to the sad fact that Coverity cannot be tried without first receiving the Print of Approval of Coverity Sales Staff, there is another significant difference between Coverity and PVS-Studio that anyone can notice. It...



COMMERCIAL MATERIALS



How can I do



Let's take a look at a typical PVS-Studio scan report. This one just caught me, so I'll give you a link to it.



A typo ... Yeah, I see. Ability to go beyond the array ... I see. A few smaller bugs ... I see. I have no idea how these shortcomings can affect the work of the program, but they are presented extremely clearly, and you can easily appreciate their significance if you consider it necessary to pay attention to them.



Someone may wonder how the program could work, having all these terrible errors in the code.



Everything is very simple. Problems that clearly emerge in the text of the program, were previously discovered using other methods - good old debugging, unit tests, expert assessment, something else. But to detect all other defects, you need to make some effort. This may be, for example, an unusual data set. Or atypical algorithm of user actions. Or an unusual indication of errors. Or maybe an upgrade version of the compiler or the C ++ library.



Errors have errors. As they say, you can't lie to the compiler, but not all errors are equal. The smallest flaws can hide in your database for many years, and then someone will chase her through PVS-Studio, and ... “WOW YOU, HOW MUCH HERE TERRIBLE BAGS, MY MY 1111 !!!” he exclaims.



So a scan report does little by itself - it still requires a developer who is familiar with the code base to evaluate and, if possible, solve each indicated problem. Scan reports in PVS-Studio do exactly what they should - they show the errors found one by one, giving brief explanations - nothing superfluous.



How not to do



Now let's take a look at the coverity commercial material. You are unlikely to find a scan report with Coverity analysis results like the one I referred to above. At the same time, the guys from Coverity sometimes issue Integrity Report (Integrity Report).



Integrity Report is an enthusiastic document, containing words like “mission”, “seamless” and “focus on innovation.” Not bad for starters - at least the presence of such keywords clearly shows that there is enough marketing on the first three pages.



Moving on to Table A ... Oh, this tablet shows the size distribution of the projects. Somehow, the use of the word “distribution” implies that the data collected has some statistical significance, and therefore deserves special confidence. Well, if you have 45 projects and you are trying to build a graph based on them, then it is very foolish to call this “distribution”. You see, they have TWO projects with more than 7 million lines of code. Incredibly, no words.



The rest of the text of the Report is also filled with similar absolutely meaningless signs. Yes, it's cool that you found 9.7654 errors per square foot of a project. But until you give me a chance to try your program, I don’t care, these numbers for me mean no more than a statement about achieving efficiency of 132 percent ( fasting is already five years old, but it is still relevant ).



Fast forward to Appendix A. Tables 2 and 3 summarize the errors, but at the same time distribute them into categories and indicate the degree of their impact on the program. Let's get a look...



Control flow errors What is it? This is when I forget to write “break;” at the end of the “case” in the statement “switch”, or what? You say it has an average impact ... Okay. How about “main ()” returned immediately? This is also a control flow error, and do not tell me that it has an average impact. Not all control flow errors are equal.



Dereferencing null pointers also has a medium impact, right? Yeah, my code here and there is dereferencing null pointers, and each time users get a candy. Perhaps, the authors of the Report meant potential dereferencing of null pointers when the code dereferenced a pointer without checking before that that it is not null. The good news is that if you check a pointer to a zero value every time we are going to dereference it, it will be very cluttered with code. Again, not all dereferencing errors of null pointers are equal.



Error handling errors. What is it? What is meant by checking the error codes of Win32 API functions? Of course, every time the program tries to open the file without appreciating the success of this attempt, and continues reading further, it’s okay, the user will say. No access to the folder? Well, let's pretend that the file is saved. Not all defects in error handling are equal.



Problems working with integer types have a medium impact. Precisely, the overflow of the integer type when calculating the size of the allocated memory is nonsense. Just select how much it will turn out, and we will assume that this is the right amount. Not all problems of working with integer types are equal.



Dealing with unprotected data has a medium impact. What are you speaking about? No clue, but something tells me that not all situations of working with unprotected data are equal.



Invalid expression - medium impact. Of course, place the brackets, as you please - what is there to do.



Simultaneous access errors - medium impact. Just think, dig up with their debugging for the rest of your life, do not worry.



API usage errors are medium impact. Your code mistakenly forgets to specify the path, and this leads to the deletion of everything in the Windows \ System32 directory. I, too, mistake.



Program hang is medium impact. The program hangs only when it is launched on a computer outside the Windows NT network. Everything works fine for you while you drive it inside your corporate network, then you go to the exhibition, and it stops working, and your laptop turns into a radiator with a screen for a thousand dollars. Nonsense.



I wonder why not a single category is assigned a degree of low impact? Perhaps the authors did not dare to attribute the low level of impact to a program error simply because it belongs to a group?



This does not work. You can not scatter several thousand errors in several categories, and the latter to assign the degree of impact. It is simply impossible. If you are a software developer, you should accept this without a shadow of a doubt, otherwise it’s better to immediately get away and go to the nearest McDonald’s - they have a sign “employees are required” for you.



This whole integrity check report is just a jumble of numbers and diagrams, and its usefulness is not even zero - it is negative. This report will scare to death anyone who cares about the quality of the software and decides to read the document.



results



So, what is the difference between PVS-Studio and Coverity commercial materials? The first presents you with facts that can be interpreted and verified. The second ones are just trying to scare you with aggregated data and do not provide any opportunity to check them.



Because not everyone deserves a free trial of Coverity.



PVS-Studio should be for those who care about the quality of the code



Posted by: Adam Savicki



Source: quotation from the article " Static Analysis of C ++ Code Using PVS-Studio " (EN).



In general, PVS-Studio looks like a good tool for C ++ programmers who care about the quality of their code. Finding problems related to OpenMP and 64-bit compatibility can be very useful for those who need such features.



It’s too bad that PVS-Studio, in contrast to Cppcheck, is a Visual Studio plugin, and not a standalone application, so it definitely requires that you have a commercial version of MSVS and does not work in the Express edition. But this can be understood - if you need OpenMP or 64-bit, you may already be using a version of Visual Studio Professional or better.



Briefly: PVS-Studio is a great tool.



By: Florian George (working as a programmer since 2009 in a company engaged in the analysis of computer vision and computer images)



Source: a letter in which a person answers us to a request to evaluate the PVS-Studio analyzer.



I am very impressed with PVS-Studio.



You already have a large base, and you can catch a lot more errors than, say, / analyze and Cppcheck. In addition, if you look at the change log, it is often updated. I really like that for each error detailed explanations are given with examples and recommendations on how to correct them. The truth is sometimes I do not really understand the meaning of the problem and how to fix it. I think it would be useful if you give your customers, or even just visitors, the opportunity to write comments in a special form at the bottom of the page for each error, where they can tell how correctly they understood the description of the error and whether it helped them successfully fix it in their code. and if not, they would provide you with a code that, in turn, will help you improve the description of the error explanations in the messages. To begin with, maybe even the opportunity to leave comments on the error documentation pages will come down.



Productivity is good, the tool uses all the cores, and, to be honest, I would rather expect a reduction in the speed of work in the future as more and more new diagnosed problems are added.



Integration with Visual Studio is excellent, everything works as it should. The function “click to jump to the code” is very convenient, so it’s not surprising that it was taken as a distinctive feature of the full version compared to the trial version.



I stumbled upon static code analysis randomly and have since read a large number of notes on your blog (cool notes!), As well as articles on AltDevBlog, Random ASCII, etc., as a result of which I became very interested in the subject.



I work in a small company of 10 people. Unfortunately, I can’t convince the boss to pay a few thousand dollars for software, the benefit of which for him personally will not be immediately apparent. The same thing happened when I offered to purchase a license for Vtune. So now I'm tied to the trial version and doing manual navigation, as suggested in one of the blog posts, but at the same time it is very inconvenient when used regularly. It seems to me that you are faced with a situation (many other people who are interested in PVS-Studio may have come across something similar, which is both funny and sad at the same time - there are people who like what you are doing, but for certain reasons they can not go and buy the full version.



You have a great product at a very competitive price compared to other professional solutions. I would like you to make a leap towards a wider mass audience. At the moment, only the fear of people to miss the “last offer”, mainly regarding prices, I think, can make them buy the product without hesitation, just as we rush to buy the game on Steam as soon as we see the weekly discount on it.



I hope this letter has given you some insight into how PVS-Studio is perceived here with us. Keep up the good work!



A spoon of tar



Of course, we come across less positive reviews, like this (RU). We did not talk about them, not because of the desire to embellish PVS-Studio. Many of the deficiencies identified in the reviews have been eliminated or we are working on them. For example, it makes no sense to talk about the recall, where it is written that PVS-Studio is completely unable to catch null pointers. Now this is not true. The analyzer has already appeared several diagnostics on this topic.



Also, a lot of negative reviews are related to the slow speed of PVS-Studio. But when we begin to find out the reasons, it turns out that, as a rule, it is not his fault. For example, the project is on a network drive. Then the analysis is performed very slowly, since in the process of work large preprocessed * .i files are generated. Another example. PVS-Studio.exe (and the Clang preprocessor) is launched in parallel many times. And often the antivirus introduces a slowdown, meaninglessly checking these executable modules again and again. I propose to get acquainted with the article " Tips for increasing the speed of PVS-Studio ".

Source: https://habr.com/ru/post/147401/



All Articles