Integer to pointer conversion

A type conversion from integer to pointer is inherently dangerous and should be avoided.

Conversions between pointers and integers fail catastrophically if the size of the integer is smaller than the size of a pointer. The presence of conversions from integer to pointer makes it impossible for an application to run correctly if it is ever rebuilt to run in 64-bit pointer mode.

ID

Observation

Description

1

Type conversion

This shows where the conversion was performed

Example

          
void f(int really_a_pointer)
{
    char * p = (char *)really_a_pointer; // bad idea
    p[0] = 'a';
}
        

Copyright © 2010, Intel Corporation. All rights reserved.