C++

Searching for explicit conversion of a pointer to a 32-bit type

In Visual Studio C++ compiler, there is the warning C4311 ('variable' : pointer truncation from 'type' to 'type') intended to detect errors of casting a pointer to 32-bit data types. This warning corresponds to warning #810 in Intel C++. This is an example of the defect they diagnose:
void *ptr = x;

int y = (int)ptr;

Static analysis and regular expressions

I develop the PVS-Studio static code analyzer intended for analyzing C/C++ software. After we implemented general analysis in PVS-Studio 4.00, we received a lot of responses, both positive and negative. By the way, you are welcome to download a new version of PVS-Studio where we have fixed a lot of errors and defects thanks to users who told us about them.

Difference of code analysis approaches in compilers and specialized tools

Compilers and third-party static code analyzers have one common task: to detect dangerous code fragments. However, there is a great difference in the types of analysis performed by each kind of these tools.
  • errors
  • C++
  • Intel C++
  • PVS-Studio
  • code review
  • 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. The article is intended for Windows-application developers who use Visual C++, however, it will be useful for other programmers as well.
  • errors
  • C++
  • Porting
  • Intel 64
  • 64-bit
  • PVS-Studio
  • x86-64
  • Win64
  • Detecting the install path for Microsoft Visual Studio from C++

    During a recent project I needed to find out the install location of the Microsoft Visual Studio version a user has, in order to be able to run compiles from the command line, and run Vcvars32.bat to set up the required environment variables. Though there's enough information on the web do figure out how to do this, no one article had the complete solution so I thought I'd post mine here.

    Páginas

    Suscribirse a C++