Library tutorials & articles
Typical errors of porting C++ code on the 64-bit platform
- Introduction
- Off-warnings
- Use of the functions with a variable number of arguments
- Magic numbers
- Bit shifting operations
- Storing of pointer addresses
- Memsize types in unions
- Change of an array type
- Virtual functions with arguments of memsize type
- Serialization and data exchange
- Pointer address arithmetic
- Arrays indexing
- Mixed use of simple integer types and memsize types
- Implicit type conversions while using functions
- Overload functions
- Data alignment
- The use of outdated functions and predefined constants
- Explicit type conversions
- Error diagnosis
- Unit test
- Code review
- Built-in means of compilers
- Static analyzers
- Conclusion
- Resources
Static analyzers
Static analyzers are a fine means to improve quality and safety of the program code. The basic difficulty related to the use of static analyzers consists in the fact that they generate quite a lot false warning messages about potential errors. Programmers being lazy by nature use this argument to find some way not to correct the found errors. In Microsoft this problem is solved by including necessarily the found errors in the bug tracking system. Thus a programmer just cannot choose between the correction of the code and tries to avoid this.
We think that such strict rules are justified. The profit of the quality code covers the outlay of time for static analysis and corresponding code modification. This profit is achieved by means of simplifying the code support and reducing the time of debugging and testing.
Static analyzers may be successfully used for diagnosing many of the kinds of errors observed in the article.
The authors know 3 static analyzers which are supposed to have means of diagnosing errors related to the port of programs on 64-bit systems. We would like to warn you at once that we may be mistaken about the possibilities they have, moreover, these are developing products and new versions may have great efficiency.
- Gimpel Software PC-Lint (http://www.gimpel.com). This analyzer has a large list of supported platforms and is the static analyzer of general purpose. It allows to catch errors while porting program on the architecture with LP64 data model. The advantage is the possibility to organize strict control over the type conversions. What the disadvantages are concerned the only one of them is the absence of the environment but it may be corrected by using the external Riverblade Visual Lint.
- Parasoft C++test (http://www.parasoft.com). Another well-know static analyzer of general purpose. It has the support of a lot of device and program platforms too. It has built-in environment which simplifies the work and setting of the analysis rules greatly. As well as PC-Lint it is intended for LP64 data model.
- Viva64 (http://www.viva64.com). Unlike other analyzers it is intended to work with Windows (LLP64) data model. It is integrated into the development environment Visual Studio 2005. It is intended only for diagnosing problems related to the port of programs on 64-bit systems and that simplifies its setting greatly.
Related articles
Related discussion
-
WinGDB - Linux debugging under Visual Studio
by WinGDB (0 replies)
-
Regarding Serial port communication
by raghu550 (0 replies)
-
VS2005 app's won't run on another machine
by ted4444 (0 replies)
-
VB.NET: Hide and show table using radio buttons
by converter2009 (1 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
Related podcasts
-
Interview with Shawn Burke on Microsoft's .NET Source Code Release
Scott and Carl talk with Shawn Burke on the culmination of his many-year-old plan to get parts of the source of the .NET Framework released. With Visual Studio 2008, a simple process will allow developers to STEP INTO the .NET Framework Source from the IDE. This'll be a great debugging and learni...
This thread is for discussions of Typical errors of porting C++ code on the 64-bit platform.