05.02.2010
/Wp64 switch and template processing error
While maintaining the analyzer Viva64 (included into PVS-Studio) we often comment upon the switch /Wp64 of Microsoft Visual C++.»
03.02.2010
Parallel notes N1 - OpenMP technology
In the next few posts we will tell you about using multi-core processors in practice.»
29.01.2010
64-bit technologies - one more trend in the modern software
In the blogs and forums, there is much discussion of multi-core processors as an evident step of computer system development.»
2.02.2010 "Lessons of 64-bit C/C++ software development" are now available on our site.»
1.02.2010 PVS-Studio 3.45 New Version Released!»
21.01.2010 PVS-Studio 3.44 New Version Released!»
10.12.2009
PVS-Studio FAQ
This paper contains some questions and answers about PVS-Studio code analyzer by OOO "Program Verification Systems".»
09.12.2009
VivaCore FAQ
This paper contains some questions and answers about VivaCore C/C++ code analysis library by OOO "Program Verification Systems"»
23.11.2009
PVS-Studio: using the function "Mark as False Alarm"
The article describes and demonstrates by an example the use of PVS-Studio 3.40 new function "Mark as False Alarm". »
ptrdiff_t. A basic signed integer C/C++ type. The type's size is chosen so that it could store the maximum size of a theoretically possible array of any type. On a 32-bit system ptrdiff_t will take 32 bits and on a 64-bit one - 64 bits. In other words, a pointer can be safely put inside ptrdiff_t type (an exception is class-function-pointers but this is a special case). By the way the result of the expression where one pointer is subtracted from another (ptr1-ptr2) will have ptrdiff_t type. ptrdiff_t type is usually used for loop, array indexing, size storage and address arithmetic. ptrdiff_t type has its synonym intptr_t whose name indicates more clearly that it can store a pointer. In some cases using ptrdiff_t type is more effective and safe than using a more habitual for the programmer int type.
In the terms of static analyzer PVS-Studio, type ptrdiff_t refers to memsize-types. The analyzer includes Viva64 system for detailed error detection in 64-bit programs and for code optimization. Many diagnostic messages shown by Viva64 analyzer relate to recommendations on using memsize-types. Using memsize-types (such as size_t, ptrdiff_t, INT_PTR) instead of 32-bit types (int, unsigned) in 64-bit programs allows you to:
To learn more about the errors you can avoid when using ptrdiff_t type and also how this type allows improving and optimizing your 64-bit programs, see the articles given in the references.
If you are planning to start developing 64-bit projects or porting the existing 32-bit projects on 64-bit systems, we would like to offer you purchasing PVS-Studio analyzer which will simplify this task greatly and allow you to avoid the long period of searching hidden errors.