The authors of the PVS-Studio analyzer invite you to test your attentiveness.
Code analyzers never get tired and can find errors a human's eye cannot easily notice. We have picked a few code fragments with errors revealed by PVS-Studio, all the fragments taken from well-known open-source projects.
We invite you to take part in a competition against code analyzers to test your agility by trying to find the errors by yourself. You will be offered 15 randomly selected tasks. Every correct answer earns you one score if you give it within 60 seconds. The code fragments are short and 60 seconds is a fair limit.
Let's examine a couple of examples with errors for you to understand how to give the answer.
There are 3 types of lies: Lies, damned lies, and statisticsStatistics, infographics, data analysis and data science – who isn’t doing it right now. Everyone knows how to do it right, just left for someone to write how you SHOULDN’T do it. In the article we’ll try to fix it.
(Hazen Robert "Curve fitting". 1978, Science.)
- Sampling Bias
- Well-chosen average
- 10 more failed experiments of which we haven’t written yet
- Playing with scale
- Selecting 100%
- Hiding main numbers
- Visual metaphor
- Example of qualitative visualization
- Conclusion and what to read next
As you know, our main activity is development of the code analyzers PVS-Studio and CppCat. Although we have been doing this for a long time now and - as we believe - quite successfully, an unusual idea struck us recently. You see, we do not use our own tools in exactly the same way our customers do. Well, we analyze the code of PVS-Studio by PVS-Studio of course, but, honestly, the PVS-Studio project is far from large. Also, the manner of working with PVS-Studio's code is different from that of working with Chromium's or LLVM's code, for example.
We felt like putting ourselves in our customers' shoes to see how our tool is used in long-term projects. You see, project checks we regularly do and report about in our numerous articles are done just the way we would never want our analyzer to be used. Running the tool on a project once, fixing a bunch of bugs, and repeating it all again just one year later is totally incorrect. The routine of coding implies that the analyzer ought to be used regularly - daily.
OK, what's the purpose of all that talk? Our theoretical wishes about trying ourselves in third-party projects have coincided with practical opportunities we started to be offered not so long ago. Last year we decided to allocate a separate team in our company to take up - ugh! - outsourcing; that is, take part in third-party projects as a developer team. Moreover, we were interested in long-term and rather large projects, i.e. requiring not less than 2-3 developers and not less than 6 months of development. We had two goals to accomplish:
- try an alternative kind of business (custom development as opposed to own product development);
- see with our own eyes how PVS-Studio is used in long-term projects.
Google Company has announced new 7-inch tablet for developers, but now it is the part of Tango project. If Asus Nexus is generally familiar tablet, then Tablet Development Kit is a true vundervafli with price $1024, which cannot be bought by everyone, it is not because of the price.
Recently, NASA and ESA published to the public fascinating photo of visible part of the universe. Source is Hubble Ultra Deep Field. On the photo, you can count 10 thousand galaxies and even more stars. It should be noted that you can see a lot of points with different colors. These are galaxies too.
Yesterday Google announced 64-bit version of Chrome. If you want to get one, you have to choose between Dev Channel and Canary channel for Windows 7 and 8 users.
I dare to suppose, that 64-bits builds of browser soon or later will be moved to the beta stage.
According to the developers, new version of Chrome is about 25% faster than the regular one. Furthermore, browser supports some features of Windows 8, for example High Entropy ASLR, which makes browse just a little bit safer.
I have studied numbers of errors caused by using the Copy-Pate method and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have never seen this phenomenon described in books on programming, so I decided to write about it myself. I called it the "last line effect".
The first impressions are most lasting! It is relevant not only in life, but also in design. The design impression consists of a number of factors, and one of the most important is the color.
It is not always easy to understand what colors go together, and this article covers the basics of color theory, which will be useful in choosing a color scheme for the website design. Let's start with the basics.
Really simple and amazing CSS-effect
Recently I have come across a really simple and amazing in implementation rollover effect for the buttons on CSS menu. Its creator is some Japanese under a nickname ksk1015 in Twitter.
Here are its demo effect and writing process.
It is common practice not to like Windows. But, as a rule, phrase: “I haven't read the book but still condemn it” describes this situation well. Despite the tendency of not like Windows, there are still some things that are implemented well. I’d like to tell you about one of them.
I’ll review the embedded into OS implementation of the lock-free stack and its performance comparison with the cross-platform analogues.
The implementation of non-blocking stack on the basis of a singly linked list (Interlocked Singly Linked Lists, SList), has been available in WinAPI for quite a while. Operations on such list initializing and stack primitives over it have been implemented. Without going into details of implementing the SLists, the Microsoft just say that they use some non-blocking algorithm in order to implement atomic synchronization, increase performance and get rid of lock problems.