Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-12-01 18:41:38


--- In boost_at_[hidden], "Ed Brey" <brey_at_a...> wrote:
> From: "David Abrahams" <abrahams_at_m...>
> >
> > > I also have a semi-nit: The long list of catches for classes
deriving
> from
> > > std::exception, could be replaced by:
> > > catch ( const std::exception & ex )
> > > { std::cout << typeid(ex).name() << ": " << ex.what() <<
> std::endl; }
> >
> > That's doesn't give you portably readable output. Some compilers
(e.g.
> gcc)
> > don't produce human-readable typeid(T).name() results.
>
> There is a reason to take advantage of compilers provide nice
type_info
> names:you see the actual class of the exception that was thrown
(e.g.
> boost::lexical_cast::bad_cast), rather than the nearest base that
happened
> to be coded in the catch list. Of course, that advantage isn't
worth
> forsaking compilers with lower QOI that provide yucky names.

I know what you're saying, but in my opinion it's hard to label this
as a QOI. Why? Because one can make a good case for making name()
return a very small string, such as a number or even an empty string,
in order to reduce code bloat. For embedded architectures this could
be very important (though typically they'd want to eliminate RTTI
entirely, I'd think).

Bill Kempf


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