Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2005-06-23 18:35:29


David Abrahams wrote:
> "Fernando Cacciola" <fernando_cacciola_at_[hidden]> writes:
>
>> David Abrahams wrote:
>>> Markus Schöpflin <markus.schoepflin_at_[hidden]> writes:
>>>
>>> I'm guessing that in strict ansi mode there's no specialization of
>>> numeric_limits<unsigned long long>. But the real problem here is
>>> that Fernando Cacciola is supposed to fix a looming ODR violation
>>> and replace the old numeric_cast with one that's already written
>>> and in Boost.
>>>
>>> http://lists.boost.org/boost/2005/06/28914.php
>>>
>>> Whassup, Fernando?
>>>
>> Yea, I'm sorry, since the arrival of the new family menmber (our
>> son) I'm trying to pull back toghether my work life.
>
> Congratulations!
>
Thank you :-)

>> I'm finishing the fix right now.
>
> Thank you very much! Do we need to update the docs for numeric_cast
> or redirect them somehow?
>
OK, I commited the fixes.

Here's a list of the changes:

(1)
Removed the numeric_cast<> code from boost/cast.hpp and added
an #include <boost/numeric/conversion/cast.hpp> in its place

This change unfortunately means that users of boost/cast.hpp,
even for the other casts, are going to get most of the
numeric conversion library in; but I don't see any
way to automatically "replace" the old numeric_cast<>.

(2)
Extracted the old numeric_cast<> code into a new file in the
numeric conversion library folders.

(3)
Added a BOOST_WORKAROUND switch into the new
boost/numeric/conversion/cast.hpp
to redirect the implementation to the old code
for those old compilers that can't deal with the
new code.

(4)
Fixed the documentation (on all affected places)

(5)
Removed the numeric_cast_test.cpp from the
conversion jamfile.

(6)
Temporarily removed all the failure marks on the
numeric/conversion library.
I need this to determine clearly which compilers
need the redirection to the old code and why
(the fix could be trivial)
After a run of regressions, I'll look at the reports,
adjust the redirection macros and put back the
failure marks accordingly.

IMPORTANT CHANGES:

(A)

My new numeric_cast<> used as an exception class:

bad_numeric_conversion

while the old code used

bad_numeric_cast

Now that the old code is superseeded by the new one,
I adopted bad_numeric_cast, which means that
if there is any user of the new code relying on it,
that code will stop compiling.
I have placed a note in the updated documentation,
but I suppose I ought to add the note to some
release notes as well.
Where should I add that? The main index.html?

(B) I happen to have bcc5.5.1, which is not on the
regressions list but I tested my code with it.
It works except for one thing: borland complains
about both a template function and a class
named "numeric_cast".
This is a problem introduced by "boost/mpl/numeric_cast.hpp"
which contains a workaround to solve it,
but that workaround was not contemplating
BCC as a candidate, so I added

|| BOOST_WORKAROUND(__BORLANDC__,<=0x700)

to it.

Notice that I tested against the last known BCC
version and not just the one I have.

Best

Fernando Cacciola
SciSoft


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