Add const char* constructors for exception classes in <stdexcept>

Jonathan Wakely jwakely.gcc@gmail.com
Thu Dec 19 01:19:00 GMT 2013


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.



More information about the Libstdc++ mailing list