share/compat.h contains the following code: /* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ #ifdef _MSC_VER #define FLAC__U64L(x) x #else #define FLAC__U64L(x) x##LLU #endif I tested MSVS 2005 and indeed it doesn't support LLU suffix, but it can compile a code with ULL suffix. Also, http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html mentions ?ULL? suffix, not ?LLU?. I don't know about VS2003 or earlier versions, but if FLAC supports only Visual Studio 2005 and newer, it's possible to reduce this code to: #define FLAC__U64L(x) x##ULL Another version: /* adjust for compilers that can't understand using ULL suffix for uint64_t literals */ #ifdef _MSC_VER #define FLAC__U64L(x) x##ui64 #else #define FLAC__U64L(x) x##ULL #endif
lvqcl wrote:> share/compat.h contains the following code: > > /* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ > #ifdef _MSC_VER > #define FLAC__U64L(x) x > #else > #define FLAC__U64L(x) x##LLU > #endif > > I tested MSVS 2005 and indeed it doesn't support LLU suffix, but it can compile > a code with ULL suffix. Also, http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html > mentions ?ULL? suffix, not ?LLU?. > > I don't know about VS2003 or earlier versions, but if FLAC supports only > Visual Studio 2005 and newer, it's possible to reduce this code to: > > #define FLAC__U64L(x) x##ULLI like that one! If that works in VS2005 and later I see no reason to use anything else. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:>> #define FLAC__U64L(x) x##ULL > > I like that one! If that works in VS2005 and later I see no reason to use > anything else.MSVS 2005 Express compiles the code... #define FLAC__U64L(x) x##ULL int test = FLAC__U64L(0x1234567890); ... and generates 0 errors, 2 warnings: warning C4305: 'initializing' : truncation from 'unsigned __int64' to 'int' warning C4309: 'initializing' : truncation of constant value so it treats 0x1234567890ULL as 'unsigned __int64' constant.