3

I'm trying to figure out what values I can expect for the Windows macro _INTEGRAL_MAX_BITS.
MSDN's __int64 documentation says that this code should be used whenever using __int64

#if defined (_INTEGRAL_MAX_BITS) && \
      _INTEGRAL_MAX_BITS >= 64
    typedef signed __int64 int64;
    typedef unsigned __int64 uint64;
#else
    #error __int64 type not supported
#endif

Why would I ever see a value below 32 for INTEGRAL_MAX_BITS? The answers in this question show that on 32 bit Windows, a long long is 64 bits. VS2013 documentation states that

_INTEGRAL_MAX_BITS - Reports the maximum size (in bits) for an integral type as an integer literal.

Since long long is an integral type, the lowest value that should be returned, even on 32 bit Windows, is 64 bits, right?
Why is the _INTEGRAL_MAX_BITS >= 64 portion of the #if necessary?

Community
  • 1
  • 1
Tesomas
  • 35
  • 1
  • 5

1 Answers1

5

That documentation is for Visual Studio 6.0. Visual Studio 6.0 was released in 1998, which was before any long long was standardised, and did not support it. It did support the __int64 you see in the documentation, so that could be unconditionally used, but presumably the check on _INTEGRAL_MAX_BITS is to get a better error message for even older versions of Visual Studio. "__int64 type not supported" is a useful error message. Something like "syntax error before unexpected token 'int64'" is not a useful error message.