|
Boost : |
Subject: Re: [boost] [chrono] New Features + Bug fixes + Updateddocumentation
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2009-12-13 12:55:37
On Dec 13, 2009, at 12:50 PM, vicente.botet wrote:
> Hi,
> ----- Original Message -----
> From: "Howard Hinnant" <howard.hinnant_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Saturday, December 12, 2009 2:40 PM
> Subject: Re: [boost] [chrono] New Features + Bug fixes + Updateddocumentation
>
>
>>
>> On Dec 12, 2009, at 5:22 AM, vicente.botet wrote:
>>
>>> I have also installed MSVC and I have an issue with the ratio_fail_test1.cpp test. MSVC report a warning instead of an error.
>>>
>>> I have added
>>>
>>> [ compile-fail ratio_fail_test1.cpp : <warnings-as-errors>on ]
>>>
>>> and all is right.
>>>
>>> Is there another way to make MSVC report an error when there is an integral constant overflow?
>>
>> The intent is to have ll_mul cause an error with the C++0x feature "static_assert" instead of relying on the compiler to do it. This line:
>>
>> static char test[a_x <= max / a_y];
>>
>> is meant to fail at compile time if there is an overflow during multiplication. I suggest you insert the boost macro version of static_assert (I'm not sure what the syntax is). It has probably already been tuned to work well on MSVC. If you do this throughout, everywhere I've got a commented out static_assert, and arrays of char, I think you'll get what you're looking for. Sorry, I should've done this in the first place.
>>
>
> I have replaced the use of static_assert by BOOST_STATIC_ASSERT and added a conditional compilation on BOOST_CHRONO_USES_STATIC_ASSERT and now this works as expected.
>
> Do you think it is worth removing the dependency to Boost.StaticAssert?
No, I think use of boost's static_assert is fine. Over time that will migrate to the C++0X static_assert without this code needing to change.
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk