compilation of __int64 & g++
The following code :
static const __int64 myLong = 116444736000000000;
compile in MSVC but not with g++. The exception handled says that the affected number is too long.
The solution is to define an Unsigned Long Long type:
#define ULL unsigned long long
and use that definition in your code following:
LLU myFunction() {
static const LLU myLong = 116444736000000000LLU;
LLU myReturnLong;
...
return myReturnLong
}
Don't forget to postfix the long number with "LLU"
and that's it !
static const __int64 myLong = 116444736000000000;
compile in MSVC but not with g++. The exception handled says that the affected number is too long.
The solution is to define an Unsigned Long Long type:
#define ULL unsigned long long
and use that definition in your code following:
LLU myFunction() {
static const LLU myLong = 116444736000000000LLU;
LLU myReturnLong;
...
return myReturnLong
}
Don't forget to postfix the long number with "LLU"
and that's it !
Retour aux articles de la catégorie Computer sciences -