Add const char* constructors for exception classes in <stdexcept>
Oleg Endo
oleg.endo@t-online.de
Thu Dec 19 12:22:00 GMT 2013
On Thu, 2013-12-19 at 07:08 -0500, Ed Smith-Rowland wrote:
> On 12/18/2013 07:10 PM, 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 tried to add these back in
> http://gcc.gnu.org/ml/libstdc++/2012-10/msg00165.html
> and http://gcc.gnu.org/ml/libstdc++/2012-10/msg00099.html.
>
> Look at the discussion for why not maybe? I didn't get much from the
> comments myself.
>
> Maybe you'll have better luck.
>
Yeah, I just found that thread and was reading it -- seems to end
nowhere :)
Jonathan, was that the thing you were trying to remember?
Notice that my version of the patch would add more symbols to the
library (one for every ctor overload), since I'm not using any inline
functions. That's on purpose, to reduce code bloat on the thrower site.
I don't understand what's the problem with adding new symbols. Removing
symbols breaks backwards compatibility, but adding?
Cheers,
Oleg
More information about the Libstdc++
mailing list