nothrow by default
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Jan 9 23:09:50 UTC 2020
On Thursday, 9 January 2020 at 22:39:25 UTC, Johannes Pfau wrote:
> I don't know the details, but I guess that's the throw by value
> / catch by reference idiom in C++. Not sure how it's actually
> implemented.
It is implementation defined... in clang it uses a dedicated
allocator function. But as you can see it does some optimizations:
https://llvm.org/docs/ExceptionHandling.html
> In addition to constructor + cache miss you'll also have to do
> RTTI to match the object to the types in the catch handlers
> (and for the downcast).
I assume that is how clang++ does it, but you don't _have_ to use
RTTI structures. You could do it other ways. But in C++
exceptions tend not to be used on the fast-path (meaning, used
primarily for unexpected outcomes).
More information about the Digitalmars-d
mailing list