This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
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: "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: Thu, 19 Dec 2013 01:19:06 +0000
- Subject: 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>
On 19 December 2013 00:10, Oleg Endo wrote:
> Hello,
>
> When writing code such as
> ...
> throw std::logic_error ("cold coffee");
> ...
> currently the construction of std::string happens in the code that
> throws the exception, which results in code bloat. Implementing the
> const char* constructors as defined by C++11 fixes the issue.
> I'm not sure whether the #if __cplusplus >= 201103L checks are required.
> C++98 code could also benefit from the overloads.
I think there was some good reason we haven't added these yet, but I
can't remember it.
> Tested with 'make all' and 'make install', writing a hello world and
> checking the asm output.
For all patches we need to know that the libstdc++ testsuite passes too.