Herb Sutter on zero cost exceptions for C++

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Sep 27 22:53:22 UTC 2019


On Friday, 27 September 2019 at 17:26:02 UTC, Jonathan Marler 
wrote:
> On Thursday, 26 September 2019 at 17:51:16 UTC, shfit wrote:
>> Herb Sutter gave a pretty interesting talk on zero cost 
>> exceptions and RTTI.
>>
>> https://m.youtube.com/watch?v=ARYP83yNAWk
>>
>> Could this be an option for D to avoid @gc exceptions?
>
> Wow this is a really big deal.  Zero-overhead exception with no 
> memory allocation.  Could be a big feature for D.

Well, IIRC modern C++ does not do memory allocation today, it 
uses a preallocated buffer.

What he is talking about is replicating Rust-style "Optional" 
union return values as throw/catch but implemented in registers 
only. So it is basically about reducing the amount of state that 
is transferred to the caller from the exception location with 
some hints of the implementation.

For D this will be difficult because D provides the exception 
chain.

I suggested register based throwing for D many years ago. Nothing 
new...





More information about the Digitalmars-d mailing list