This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING] Re: Add const char* constructors for exception classes in <stdexcept>
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Jan 2014 21:38:29 +0000
- Subject: Re: [PING] Re: Add const char* constructors for exception classes in <stdexcept>
- Authentication-results: sourceware.org; auth=none
- References: <1387411826 dot 2455 dot 325 dot camel at yam-132-YW-E178-FTW> <CAH6eHdTK93RwatvT+m_1TLv7Ni=yQ=wDi6v7Hq=jT=O=ZSffzw at mail dot gmail dot com> <1387466908 dot 2455 dot 355 dot camel at yam-132-YW-E178-FTW> <1390745736 dot 22215 dot 207 dot camel at yam-132-YW-E178-FTW> <20140129152136 dot GA21735 at redhat dot com> <1391030247 dot 13654 dot 9 dot camel at yam-132-YW-E178-FTW>
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.)