[Bug libstdc++/14493] std::bad_alloc::what() does not explain what happened

pcarlini at suse dot de gcc-bugzilla@gcc.gnu.org
Tue Jan 30 02:21:00 GMT 2007



------- Comment #24 from pcarlini at suse dot de  2007-01-30 02:21 -------
(In reply to comment #23)
> From consistency point of view I would say that the change should also
> be done for std::exception.  

Right.

> 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 see, but I don't think we have to do much, because the other exception
classes, provided in <stdexcept>, per the standard requirements are already
overriding what() to return _M_msg.c_str(). Thus, I'm coming to the conclusion
that we should consistently change std::exception too and be done with it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14493



More information about the Gcc-bugs mailing list