Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Integer] On Win32, boost::uint_t<65>::fast has 64 bits?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-05-02 01:40:32


AMDG

On 05/01/2012 05:25 PM, Scott Meyers wrote:
> The type yielded by boost::uint_t<N>::fast seems pretty clear: "The
> easiest-to-manipulate, built-in, unsigned integral type with at least N
> bits."
>
> But when I run the following program, which prints the number of bits in
> the type returned by boost::uint_t<65>::fast (i.e., a type with at least
> 65 bits), I get 64.
>
> #include <iostream>
> #include <climits>
> #include <boost/integer.hpp>
>
> int main()
> {
> std::cout << "boost::uint_t<65>::fast has "
> << CHAR_BIT * sizeof(boost::uint_t<65>::fast)
> << " bits\n";
> }
>
>
> I get the same results with VC10, VC11 beta, and gcc 4.7 on Win32 with
> Boost 1.49. I must be doing something wrong, right? But what?
>

Obviously this isn't going to work unless
the compiler supports a 128-bit int. I
suppose it would be better to cause a
compile error if there isn't a sufficiently
wide integer type.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net