nothrow by default

Walter Bright newshound2 at digitalmars.com
Fri Jan 10 07:06:31 UTC 2020


On 1/9/2020 7:42 PM, Gregor Mückl wrote:
> What exactly is the execution overhead for non-throwing code paths?
> 
> I believe I understand the overhead once stack unwinding needs to be performed, 
> but how is code generation affected for the normal path?

You need a mechanism for jumping to the scope guard code. Can't do any code 
motion optimizations across the boundaries of such code. Can't do register 
assignments for variables that are "live" across that boundary.

Just write some code with destructors in C++, compile it with and without 
exceptions enabled, and dump the generated assembler.


More information about the Digitalmars-d mailing list