|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2004-04-20 20:21:17
"David Abrahams" <dave_at_[hidden]> escribió en el mensaje
news:u3c6ywa5w.fsf_at_boost-consulting.com...
> "Dill, John" <john-dill_at_[hidden]> writes:
>
> > I am wondering about the use-case of numeric_cast in this sample.
> >
> > unsigned char uchar_max = std::numeric_limits<unsigned char>::max();
> > char schar_value = 0;
> >
> > try {
> > schar_value = boost::numeric_cast<char>( uchar_max );
> > }
> > catch ( boost::bad_numeric_cast )
> > { std::cout << "Overflow occurred..." << std::endl; }
> >
> > When I execute this sample, I don't get the exception. What's the
> > background on this behavior? I'm using gcc 3.3.1.
>
> FWIW, there are known problems with numeric_cast, but a numeric
> conversion library that replaces the existing implementation has been
> accepted into Boost. We are just waiting for Fernando Cacciola to
> check it in. Fernando?
>
Indeed. The accepted numeric conversions library handles this case properly
(throwing).
Right now I'm technically on vacation until next Monday. I'll start working
with the review comments right next week. I'll check it in on CVS after I
made the neccesary changes.
Anyway, users can download the review version from here:
http://personales.ciudad.com.ar/fernando_cacciola/numeric_conversions.zip
or
http://groups.yahoo.com/group/boost/files/numeric_conversions.zip
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