|
Boost : |
Subject: Re: [boost] [chrono][ratio][boost_1_52_0_beta1] warning in user code
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-10-30 02:25:36
On Tue, Oct 30, 2012 at 3:15 AM, Vicente J. Botet Escriba
<vicente.botet_at_[hidden]> wrote:
> Le 29/10/12 20:16, Jeff Flinn a écrit :
>
>> I've just downloaded boost_1_52_0_beta1 and get the warning below in my
>> user code on VC11(I'm using thread which evidently brings in the above
>> libs). I didn't see mention of this in trac. I'm moving forward from 1.47
>> and from VC8 so I'm not sure if this is an indication of some project
>> setting[s] of mine, or if it should be corrected in the lib?
>>
>> Thanks, Jeff
>>
>> 6>D:\boost_1_52_0_beta1\boost/ratio/detail/overflow_helpers.hpp(136):
>> warning C4293: '<<' : shift count negative or too big, undefined behavior
>
> The concerned code is
>
> static const boost::intmax_t nan =
> (BOOST_RATIO_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT -
> 1));
>
> I don't reach to see why the shift count could be negative or too big.
If I'm not mistaken, the shifted (positive) value exceeds the intmax_t
value range (which is signed) but fits into uintmax_t. E.g. for 64 bit
intmax_t it's 1 << 63 while intmax_t range is [-2^63; 2^63 - 1].
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk