|
Boost : |
From: Ed Brey (brey_at_[hidden])
Date: 2000-12-01 17:55:46
From: "David Abrahams" <abrahams_at_[hidden]>
>
> > 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.
Hmmm. I guess I'd handle both, since it's only 7 or so extra lines in
test_main for the ifdefs and the typeinfo-based catch. Anyone for
BOOST_MANGLED_TYPE_INFO_NAMES?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk