Predefined Preprocessor Macro to check compiler Architecture in Visual Studio C++. In example below if long was 4 bytes in 32 bit architecture and 8 bytes in 64 bit architecture we can use the macro _M_X64 and _M_IX86 to make sure the unit32 we use is always 4 bytes. Just a note that Visual Studio long is 4 bytes in both 32 and 64 bit I tested and long long is 8 bytes. So it will be no point using this macro in the sample code below but the idea is to know how to use these macros if there was a need.

For more Predefined Preprocessor Macros you can find in MSDN http://msdn.microsoft.com/en-us/libr...(v=VS.90).aspx
Preprossor directives: http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

Code:
#ifdef _M_X64
 #define uint32 unsigned int
#elif defined _M_IX86
 #define uint32 unsigned long
#else
 #error Unsupported Architecture
#endif

int _tmain(int argc, _TCHAR* argv[])
{
    uint32 i = 100;
    printf("\nSize of: %ld", sizeof(uint32));
    return 0;
}