warn_ptr_int_conv

Controls the recognition of the conversion of pointer values to incorrectly-sized integral values.

Syntax

#pragma warn_ptr_int_conv on | off | reset

Targets
All platforms.
Remarks

If you enable this pragma, the compiler issues a warning if an expression attempts to convert a pointer value to an integral type that is not large enough to hold the pointer value.

Listing 10.44 Example for #pragma warn_ptr_int_conv

#pragma warn_ptr_int_conv on

char *my_ptr;
char too_small = (char)my_ptr; // WARNING: char is too small

See also pragma warn_any_ptr_int_conv.

For more information about this warning, see “Common Errors”.

This pragma corresponds to the Pointer / Integral Conversions setting . To check this setting, use __option (warn_ptr_int_conv), described in Checking Settings. The default setting is off.