CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2016
    Posts
    35

    Post How to use PVS-Studio static code analyzer 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.

    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.

    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.

    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, enter the following license key:

    Name: PVS-Studio Free

    Key: FREE-FREE-FREE-FREE

    If you are using PVS-Studio for Linux, go to the second step, you don't need a license file.

    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.

    Source: http://www.viva64.com/en/b/0457/
    Last edited by El_programmer; November 30th, 2016 at 02:19 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured