How about avoiding the compiler suffix altogether and only cast the
constants to a (platform independent) typedef, something like
this:
#ifdef __GNUC__
typedef long long INT64;
#elif defined _MSC_VER
typedef __int64 INT64;
#else
#error Please define the INT64 typedef according to your platform
#endif
and then use something like
a = (INT64)0x1;
Or we could hide the cast behind a macro such as
#define ZZZ(x) ((INT64)(x))
(I have no idea what to put instead of ZZZ MAKE_INT64 or DEFINE_INT64).
I see several advantages to this scheme:
1) It can be used both for constants and other expressions
2) It does not care about literal suffixes (e.g. whether the ll suffix
means that the constant has a size of 64 bit or 128 bits). All we have to
do is to define the INT64 typedef appropriately. I doubt that the compiler
will generate a different code between
x = 0ll;
and
x = (long long)0;
What do you think?
Emil