On newer versions of Visual Studio and on gcc you can use the ll to tell the compiler that the value is 64 bits wide. But Visual Studio 6 does not understand it.
How do you do? You must use the keyword
__int64.
I discovered it because a project I wrote using Visual Studio 2005 that must be compiled using Visual Studio 6.
Below you can see a sample code that compiles both in VS 6 and 2005.
I really hope this piece of information will be helpful to someone.
#include
#include "stdafx.h"
#include
int main(int argc, char* argv[])
{
__int64 i = 0;
printf("Hello World! %08x %08x\n", i);
#ifdef _MSC_VER
#if _MSC_VER <= 1200
// Visual Studio 6 or lower do not accept ll as 64 bits constants.
#define __IGNORE_LL_MODIFIER_MS
#endif // _MSC_VER
#endif // _MSC_VER
#ifdef __IGNORE_LL_MODIFIER_MS
i = ((__int64)0x1234567890123456);
#else
i = 0x1234567890123456ll;
#endif
printf("Hello World! %08x %08x\n", i);
getchar();
return 0;
}
Nenhum comentário:
Postar um comentário