Ensure that the 64-Bit Compiler Can Find Type Mismatches


Avoid type-mismatch errors due to the use of #define to define constants with the 64-bit Intel® architecture. In the following code, where #define is used for a constant, the compiler cannot check the code for type mismatches:

#define mask 0x37FFC;



Specify a data type and use the ANSI C const to declare constants. This technique will allow the compiler to check for type mismatches. During compilation, if there are any type mismatches between the declaration and implementation, the compiler will warn you.

The following line of code reworks the code given in the Challenge section, using the ANSI const instead of #define:

const int mask = 0x37FFC;


Related information about migrating other types of constants from 32-bit Intel architecture to 64-bit Intel architecture is covered in the following separate items:



Preparing Code for the IA-64 Architecture (Code Clean)


Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.