PVS-Studio warning: V504 It is highly probable that the semicolon ‘;’ is missing after ‘return’ keyword. AdvancedSettings.cpp:1476
void CAdvancedSettings::SetExtraArtwork(const TiXmlElement* arttypes,
const TiXmlNode* arttype = arttypes->FirstChild("arttype");
The code formatting suggests the following execution logic:
- if arttypes is a null pointer, the method returns;
- if arttypes is a non-null pointer, the artworkMap vector gets cleared and some actions are then performed.
But the missing ‘;’ character breaks it all, and the actual execution logic is as follows:
- if arttypes is a null pointer, the artworkMap vector gets cleared and the method returns;
- if arttypes is a non-null pointer, the program executes whatever actions come next but the artworkMap vector doesn’t get cleared.
To cut a long story short, this situation does look like a bug. After all, you hardly expect anyone to write expressions like return artworkMap.clear(); :).
Please click here to see more bugs from this project.
The expectation of people with regard to software quality is profoundly unrealistic. It could be because they depend so much on software that anything less than perfect is ‘un-acceptable’.
The Microsoft Corporation has recently published, for free, access the source code of the CoreCLR engine, which is a key component of .NET Core. We couldn’t help but pay attention to this event. The wider a project’s audience is, the worse defects found in the code will seem, won’t they? Despite Microsoft themselves being the authors of the product, there are still some issues to examine and think over in their code – just like in any other large project.
Static code analysis tools can help developers eliminate numbers of bugs as early as at the coding stage. With their help you can, for example, quickly catch and fix any typos. Well, some programmers are sincerely sure they never make typos and silly mistakes. But they are wrong; everyone makes mistakes. This article is a good evidence of that. Typos can be found even in high-quality and well tested projects such as Qt.
The fragment is taken from the MFC library. The error is detected by the following diagnostic: V301 Unexpected function overloading behavior. See first argument of function ‘WinHelpW’ in derived class ‘CFrameWndEx’ and base class ‘CWnd’.