Bug of the month: relay race from PC-Lint to PVS-Studio
Recently, we published 2 articles about the TOP 10 errors in the open C ++ and C # projects for the previous 2016. Readers liked the articles and this prompted the thought: why not make such a TOP for every month? Indeed, our site has a huge database of errors, which is well structured and from which you can choose the most interesting bugs found in a certain period of time. This article will tell you about the new section “Bug of the month” and about what we proceeded from when we prepared the list of errors for it.

Someone may say that Gimpel Software already had such a section and we borrowed the idea. This is not true. What we have in common is only the name and the fact that for every month it falls on some specific bug.
To begin with, although the diagnostic number of the Gimpel Software month bug really exists, the code below is artificially created as a task with a funny description, for example: “Santa and his elves automate their Christmas delivery system, but one of the elves made a critical the mistake that caused the action in some pieces of code to happen in an unpredictable manner, "or:" Sean O'Flaherty may have been a little tipsy when he wrote the annual St. Patrick's Day celebration program at his pub. Although he did not finish it, there is still a small problem. ” It is immediately suggested that you find this bug yourself, and below you can check yourself and see what the problem was.
We took real errors that contain the Open Source projects we tested over several years. And they tried to choose obvious bugs that would be understandable not only to the most prepared reader. For example, everyone’s favorite copy-paste, which is found in almost every project, or various kinds of typos. In addition to a piece of error code, diagnostics are also provided, with the help of which PVS-Studio found it and an explanation of what the problem itself is. Below is a link to an article about checking this project, where you can see what other bugs it contained.
As written on the official website of Gimpel Software, their first “bug of the month” was found in March 1991 and the list continued to grow for 21 years. At one time they were very popular and advertised PC-Lint well. Since 2012, the updating of this section has stopped, but the developers hope that the “bug of the month” can be resurrected in the future.
In the meantime, this did not happen, we decided, so to speak, to take the baton from PC-Lint and create our own “bug of the month” withblackjack .. Open Source projects and errors found in them.

So, we looked at a large number of projects that we tested from January 2014 to March 2017 and 54 interesting errors were selected: 39 for C / C ++ language and 15 for C #, since support for C # started only in 2016. The updated bug table can be found at this link https://hownot2code.com/bug-of-the-month/ .
As mentioned above, to compile this section, we analyzed our existing database of errors and a regularly updated list of verified Open Source projects. Perhaps these materials will also be interesting and useful to readers, since they can be used in the form of recommendations on how not to make the same mistakes, can help in research related to improving the reliability of software and contribute to the development of a coding standard.
The prevalence of most of these errors (especially their presence in large projects) can be explained by the fact that in practice it is not always possible to be careful and to control every line of code, especially when there are hundreds of thousands of them. This is where Copy-Paste errors, undefined behavior, dereferencing of the null pointer, typos, and various other bugs appear that static code analysis can help with.
In order to make such errors less, and the quality of the code better, we offerDownload and use PVS-Studio on your project. Perhaps you will be able to find your interesting bug of the month, which you can subsequently tell the community of developers about and save them from a similar error. In the meantime, you can practice and try to find errors on your own in well-known Open Source projects - http://q.viva64.com/ .
Note. The recently released version of PVS-Studio 6.14 introduced support for Visual Studio 2017, Roslyn 2.0 / C # 7.0 for the C # analyzer (see version history ).
So welcome: Bug of the month!

If you want to share this article with an English-speaking audience, then please use the link to the translation: Ekaterina Milovidova. Bug of the month: taking the baton from PC-Lint to PVS-Studio

Someone may say that Gimpel Software already had such a section and we borrowed the idea. This is not true. What we have in common is only the name and the fact that for every month it falls on some specific bug.
To begin with, although the diagnostic number of the Gimpel Software month bug really exists, the code below is artificially created as a task with a funny description, for example: “Santa and his elves automate their Christmas delivery system, but one of the elves made a critical the mistake that caused the action in some pieces of code to happen in an unpredictable manner, "or:" Sean O'Flaherty may have been a little tipsy when he wrote the annual St. Patrick's Day celebration program at his pub. Although he did not finish it, there is still a small problem. ” It is immediately suggested that you find this bug yourself, and below you can check yourself and see what the problem was.
We took real errors that contain the Open Source projects we tested over several years. And they tried to choose obvious bugs that would be understandable not only to the most prepared reader. For example, everyone’s favorite copy-paste, which is found in almost every project, or various kinds of typos. In addition to a piece of error code, diagnostics are also provided, with the help of which PVS-Studio found it and an explanation of what the problem itself is. Below is a link to an article about checking this project, where you can see what other bugs it contained.
As written on the official website of Gimpel Software, their first “bug of the month” was found in March 1991 and the list continued to grow for 21 years. At one time they were very popular and advertised PC-Lint well. Since 2012, the updating of this section has stopped, but the developers hope that the “bug of the month” can be resurrected in the future.
In the meantime, this did not happen, we decided, so to speak, to take the baton from PC-Lint and create our own “bug of the month” with

So, we looked at a large number of projects that we tested from January 2014 to March 2017 and 54 interesting errors were selected: 39 for C / C ++ language and 15 for C #, since support for C # started only in 2016. The updated bug table can be found at this link https://hownot2code.com/bug-of-the-month/ .
As mentioned above, to compile this section, we analyzed our existing database of errors and a regularly updated list of verified Open Source projects. Perhaps these materials will also be interesting and useful to readers, since they can be used in the form of recommendations on how not to make the same mistakes, can help in research related to improving the reliability of software and contribute to the development of a coding standard.
The prevalence of most of these errors (especially their presence in large projects) can be explained by the fact that in practice it is not always possible to be careful and to control every line of code, especially when there are hundreds of thousands of them. This is where Copy-Paste errors, undefined behavior, dereferencing of the null pointer, typos, and various other bugs appear that static code analysis can help with.
In order to make such errors less, and the quality of the code better, we offerDownload and use PVS-Studio on your project. Perhaps you will be able to find your interesting bug of the month, which you can subsequently tell the community of developers about and save them from a similar error. In the meantime, you can practice and try to find errors on your own in well-known Open Source projects - http://q.viva64.com/ .
Note. The recently released version of PVS-Studio 6.14 introduced support for Visual Studio 2017, Roslyn 2.0 / C # 7.0 for the C # analyzer (see version history ).
So welcome: Bug of the month!

If you want to share this article with an English-speaking audience, then please use the link to the translation: Ekaterina Milovidova. Bug of the month: taking the baton from PC-Lint to PVS-Studio