[PING] Re: Add const char* constructors for exception classes in <stdexcept>

Jonathan Wakely jwakely.gcc@gmail.com
Wed Jan 29 21:38:00 GMT 2014


On 29 January 2014 21:17, Oleg Endo wrote:
> My original intention was to eliminate code bloat when doing something
> like  throw std::logic_error ("cold coffee");
> If the const char* overloads are inlined it will emit code to construct
> an std::string from const char* in user code where the exception is
> being constructed over and over again.  The idea was to move that code
> into the std library.

That's exactly what happens today with the constructors that only take
a std::string, so it wouldn't be any worse than what we have now,
would it?

> BTW the original patch was posted during Stage 3 (19.12.2013).  I don't
> mind waiting until Stage 1 if adding exports now is a problem.

OK, let's wait and decide how we want to do it properly in stage 1.

(If we're going to make various changes that impact the ABI during the
next stage 1 we might even want to consider changing the
std::exception base class to store something like a
std::shared_ptr<std::string> so that copying an exception object will
never throw an exception, which is something I've been thinking about
recently.)



More information about the Libstdc++ mailing list