How to Hide the Analyzer False Positives?

If you’re using a static analyzer, most likely you stumble upon cases when it gets something wrong and gives false positives 👎 So, somehow you need to tell it about an incorrect case and let a false warning go to long rest 💤 The good news is that we have a special mechanism for this that we’ll tell you about today.

Have a good watch and clean code 🙂

MISRA C: struggle for code quality and security

A couple of years ago the PVS-Studio analyzer got its first diagnostic rules to check program code compliance with the MISRA C and MISRA C++ standards. We collected feedback and saw that our clients were interested in using the analyzer to check their projects for MISRA compliance. So, we decided to further develop the analyzer in this direction. The article covers the MISRA C/C++ standard and the MISRA Compliance report. It also shows what we already managed to do and what we plan to achieve by the end of the year.

Continue reading

A common error occurring when compiling a 64-bit application: error C2440, OnTimer

One of the most common errors a programmer encounters when porting applications from a Win32 system to a Win64 one is the error related to the function OnTimer. The function OnTimer is used nearly in every application and you are likely to get some compilation errors. Earlier this function had the prototype “OnTimer(UINT nIDEvent)” and is most likely to be present in user classes in the same form. Now this function has the prototype “OnTimer(UINT_PTR nIDEvent)” and it causes a compilation error for the 64-bit system.

Continue reading

C++11 and 64-bit Issues

64-bit computers have been around for a long time already. Most applications have 64-bit versions that can benefit from a larger memory capacity and improved performance, thanks to the architectural capabilities of 64-bit processors. Developing a 64-bit application in C/C++ requires a great deal of attention from a programmer. There are a number of reasons for 32-bit code to fail to work properly when recompiled for the 64-bit platform. There are a lot of articles on this subject, so we will focus on another point. Let’s find out if the new features introduced in C++11 have made 64-bit software programmers’ life any better, or easier.

Без названия

Continue reading

20 issues of porting C++ code to the 64-bit platform

This article describes the process of porting a 32-bit application to 64-bit systems. The article is written for programmers who use C++ but it may also be useful for all who face the problem of porting applications onto other platforms. The authors are creators of PVS-Studio static analyzer that is a great help in the task of porting programs to the 64-bit platform.

^3A30F77AF0C5FAA6698E4F6939A8DFB436FF1CCD7E3EDE56CC^pimgpsh_fullsize_distr

Continue reading

Big Brother is helping you

Once more I got reassured that programmers write programs absolutely carelessly, so that their programs work not because of their skill but due to chance and care of Microsoft or Intel compiler developers. Right, it is them who really care and put crutches under our lop-sided programs when necessary.

Here is a byte-breaking story of the CString class and daughter of it, the Format function.

Big_Brother_15_-_2014_-_Eye_Logo_-_HQ_-_White_Background

Continue reading