[Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened
------- Comment #23 from gdr at cs dot tamu dot edu 2007-01-30 02:11 -------
Subject: Re: std::bad_alloc::what() does not explain what happened
"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #22 from pcarlini at suse dot de 2007-01-30 01:42 -------
| (In reply to comment #21)
| > I suspect Andrew Pinski's point might be that what() could return a
| > string that represents the name of the most derived type of the
| > exception. But, nothing so far forces to do that. A reasonable
| > definition is to what Paolo suggest, with clear documentation (that
| > mentions this).
|
| Agreed. Gaby, do you have any strong opinion about std::exception
| itself? In my current patch draft I'm leaving it alone, but in
| principle we could change also its what() to return "std::exception"
| instead of typeid(*this).name().
>From consistency point of view I would say that the change should also
be done for std::exception.
However, the use of typeid is very convenient in the sense that we
have to defined what() only once. Now, if we change that definition
in std::exception, it means that we should revisit all other exception
classes, such as std::runtime_error, etc.
I have no strong opinion. Probably just leave it as is, and document
the choices we face so that people see the rationale behind the
implementations.
Thanks,
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Reply to: