|
|
|||
![]() PVS-Studio Static Code Analyzer for 64-bit and parallel C/C++ code
|
|||
![]() ![]() ![]() ![]() ![]()
28.06.2010
Why is the number of the line where an issue was found sometimes absent in the Error List in PVS-Studio? Sometimes the PVS-Studio code analyzer seems to find an issue in the code on which it generates a message, specifies the file name but does not show the number of the line with the issue as shown in the figure.»
07.06.2010
Communication between developers and users Abstract When developing software products, developers need very much to get feedback from users of their programs.» ![]()
22.07.2010
Using PVS-Studio with continuous integration systems This article illustrates techniques required to employ the use of PVS-Studio static code analyzer together with continuous integration systems.»
06.07.2010
Comparing capabilities of PVS-Studio and Visual Studio 2010 in detecting defects in 64-bit programs In the article, we will compare three mechanisms of code analysis from the viewpoint of detecting 64-bit errors: the Visual C++ 2010 compiler, the Code Analysis for C/C++ component included into Visual Studio 2010 and Viva64 analyzer included into PVS-Studio 3.60.»
29.06.2010
A Collection of Examples of 64-bit Errors in Real Programs
This article is the most complete collection of examples of 64-bit errors in the C and C++ languages.» ![]()
22.07.2010
We released a new version of PVS-Studio code analyzer - PVS-Studio 3.61»
10.06.2010
We released a new version of PVS-Studio code analyzer - PVS-Studio 3.60. »
19.05.2010
Our workers visited the GDC2010 conference that was held on May, 14-16, 2010, in Moscow and talked to many developers who participated there.»
|
Terminology![]() /Wp64/Wp64 (Detect 64-Bit Portability Issues) is the key of Visual C++ compiler. The key appeared in Visual Studio 2003 and was intended for preparing migration of applications on 64-bit systems. In Visual Studio 2008 /Wp64 key is considered obsolete for it is high time we began to compile 64-bit applications and not to prepare for them. When defining /Wp64 key the compiler detects some potential errors which can occur when compiling C/C++ code for 64-bit systems. Test of the code consists in that the types marked by the key word __w64 in 32-bit code are interpreted as 64-bit types during the test. For example, we have the following code: typedef int MyInt32;
#ifdef _WIN64
typedef __int64 MySSizet;
#else
typedef int MySSizet;
#endif
void foo() {
MyInt32 value32 = 10;
MySSizet size = 20;
value32 = size;
}
"value32 = size;" expression on a 64-bit system will cause value cutoff and, consequently, to a potential error. We want to diagnose it. But when compiling a 32-bit application everything is correct and we won't get a warning message. To prepare for 64-bit systems we should add /Wp64 key and insert the key word __w64 when defining MySSizet type in a 32-bit version. As the result we have the following code: typedef int MyInt32;
#ifdef _WIN64
typedef __int64 MySSizet;
#else
typedef int __w64 MySSizet; // Add __w64 keyword
#endif
void foo() {
MyInt32 value32 = 10;
MySSizet size = 20;
value32 = size; // C4244 64-bit int assigned to 32-bit int
}
Now we'll get the warning message C4244 which will help us to prepare for porting the code on a 64-bit platform. You should understand that /Wp64's abilities are rather limited. A more detailed and specialized code test can be performed by the commercial tool Viva64 developed specially for simplifying port of applications on 64-bit systems. References | ||