Boost Integer Traits 64-bit Support
Just a quick question, does Boost integer traits classes support 64-bit
integral types? I didn't seem to be able to get the following code compile:
#include
I know that I can use boost::int64_t, but the problem is that the "64" here is not fixed in my code. It is dependent on some other parameters, so it could be 32 too.
Am I missing anything?
Apparently not: looking at the code there is no provision for use of long long when it's available. Daryle, fancy fixing this one? John.
[Sorry that I'm very late. I'm still not caught up.]
On 3/6/06 7:57 AM, "Wu Yinghui, Freddie"
Just a quick question, does Boost integer traits classes support 64-bit integral types? I didn't seem to be able to get the following code compile:
#include
#include typedef typename boost::int_t<64> int_type; typedef boost::high_bit_mask_t<63> high_bit_type; I know that I can use boost::int64_t, but the problem is that the "64" here is not fixed in my code. It is dependent on some other parameters, so it could be 32 too.
Am I missing anything?
On 3/6/06 12:53 PM, "John Maddock"
Apparently not: looking at the code there is no provision for use of long long when it's available. Daryle, fancy fixing this one?
Built-in extended types beyond "(unsigned) long" are not currently supported. So 64-bit numbers are supported only if "long" itself is at least 64 bits. The rationale for limiting the types was that types from the "int_t" template should be usable as value-based template parameters, which weren't necessarily supported for the extended built-in integer types. Can extended types be used currently for value-based template parameters on any platforms/compilers/etc.? Should we drop that idea and only worry about run-time compatibility? Should we have two kinds of templates (for compile- or run-time compatibility)? -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Built-in extended types beyond "(unsigned) long" are not currently supported. So 64-bit numbers are supported only if "long" itself is at least 64 bits. The rationale for limiting the types was that types from the "int_t" template should be usable as value-based template parameters, which weren't necessarily supported for the extended built-in integer types. Can extended types be used currently for value-based template parameters on any platforms/compilers/etc.? Should we drop that idea and only worry about run-time compatibility? Should we have two kinds of templates (for compile- or run-time compatibility)?
There used to be problems with MS's __int64 not being usable in compile time situations, but I believe nowadays long long is useable pretty much everywhere on all compilers (including recent VC++ releases). In any case better to fail later (because the 64-bit type is used in an unsupported context) than to fail early due to integer traits not supporting the type. John.
"John Maddock"
Built-in extended types beyond "(unsigned) long" are not currently supported. So 64-bit numbers are supported only if "long" itself is at least 64 bits. The rationale for limiting the types was that types from the "int_t" template should be usable as value-based template parameters, which weren't necessarily supported for the extended built-in integer types. Can extended types be used currently for value-based template parameters on any platforms/compilers/etc.? Should we drop that idea and only worry about run-time compatibility? Should we have two kinds of templates (for compile- or run-time compatibility)?
There used to be problems with MS's __int64 not being usable in compile time situations, but I believe nowadays long long is useable pretty much everywhere on all compilers (including recent VC++ releases).
Yep. I recently looked at every modern compiler Boost regressions tests are run on, and every one supported long long. Most have been supporting it for years. That coupled with the fact that long long (and unsigned long long) is already standard in C and will be standard in C++0x makes it something we should support for sure, IMO. --Beman
participants (4)
-
Beman Dawes
-
Daryle Walker
-
John Maddock
-
Wu Yinghui, Freddie