#undef GOOGLE_LONGLONG
#undef GOOGLE_ULONGLONG
#undef GOOGLE_LL_FORMAT
#ifdef _MSC_VER
#define GOOGLE_LONGLONG(x) x##I64
#define GOOGLE_ULONGLONG(x) x##UI64
#define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...)
#else
#define GOOGLE_LONGLONG(x) x##LL
#define GOOGLE_ULONGLONG(x) x##ULL
#define GOOGLE_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also.
#endif
Why do this and when to do such things?
Generally this is a bad idea. Ironically, given that you have “Google” in your symbol names, you might be curious to know that Google’s C++ Style Guide urges against undefining macros before defining them. Basically, if you define a macro multiple times, you will get an error. The undef prevents these errors, which can suppress some alarm bells that probably should be going off. There are a few cases where an undef makes sense, such as in defining
assertwhere the behavior of the macro can be different each time you include the header (based on whether some other macro is defined). If the macro should have a single value for the entire program, though, this undef doesn’t make any sense.