Gambiteer

Gambiteer

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 !


06/11/2009
0 Poster un commentaire

Inscrivez-vous au blog

Soyez prévenu par email des prochaines mises à jour