Boost logo

Boost :

From: Jeffrey C. Jacobs (darklord_at_[hidden])
Date: 2002-09-25 14:30:24


Oops! My bad!

Actually, the MSVC++ compiler considers __int<x> as separate types from int,
long, etc. (having checked the name mangling -- what a mess they make of
specializations with these MS-types!!). Let me consider the issue further
and get back to y'all but my belief remains that we should not assume
__int64 == long long, specifically when my theory is "long long" will not be
standardized at 64 bits, simply bigger or as big as long.

Thus:

int_least_helper<1> => long long
int_least_helper<2> => long
...

Should always work but:

int_least_helper<1> => __int64
int_least_helper<2> => long
...

Has a remote possiblity of failing, specifically if sizeof(long) > 8, which
I would not rule out in the long term. (Pardon my pun!)

As for how to handle long long,

I suggest:

#if defined(BOOST_LONG_LONG_...)
template<> struct int_least_helper<1> { typedef long long least; };
#endif
template<> struct int_least_helper<2> { typedef long least; };
...

struct int_t
{
...
#if defined(BOOST_LONG_LONG_...)
          (Bits-1 <= std::numeric_limits<long long>::digits) +
#else
          1+
#endif
          (Bits-1 <= std::numeric_limits<long>::digits) +
...
}
...

That would allow compatibility in internal structure between long long
compliant compilers and those non-compliant (2 is always long, etc.).

Any thoughts on that approach?

Jeffrey.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk