Let's play a game
The authors of the PVS-Studio analyzer suggest you check your attentiveness.
Code analyzers work tirelessly and can find many errors that are difficult to notice. We selected some code fragments in which we detected errors using PVS-Studio. All fragments are taken from well-known Open-Source projects.
We suggest that you compete with the analyzers in insight and try to find errors yourself. You will be offered 15 randomly selected tasks. For the correct answer, there is one point if it is given within 1 minute. The code snippets are short, and 1 minute is an honest restriction.
Consider a couple of examples with errors and explain how to indicate the correct answer.
The first example. Here is the following code:
Here the error is highlighted in red. In solving problems, of course, this will not happen.
The programmer accidentally sealed up and instead of index 2 wrote 3. When the mouse cursor moves over the code, various words and numbers will be highlighted. You must hover over the number 3 and click the left mouse button.
This will be the correct answer.
Second example. It is not always possible to unambiguously indicate where the error is: The
size of the buffer needs to be compared with the number 48. The extra sizeof () operator accidentally popped into the code. As a result, the size of the buffer is compared with the size of the int type.
In my opinion, the error is the “sizeof” operator, and it is precisely on it that you must point with the mouse. However, not having the entire text of the program before one’s eyes, one can reason like this. The operator 'sizeof' was supposed to calculate the size of some buffer, but he accidentally slipped a macro. The error is the use of "SSL3_MASTER_SECRET_LENGTH".
For such cases, the answer will be counted as true, regardless of whether you choose “sizeof” or “SSL3_MASTER_SECRET_LENGTH”.
And now we wish you good luck. Start the game .
PS We understand that the tasks are not ideal, it is not always obvious where you need to "poke the mouse", and the system can be fooled if desired. Just keep in mind that this section of the site was created for entertainment, and not for fully testing someone.