4 ms·
> some examples? Exception handling. EH is often sold as a "zero cost abstraction". The reality is far different. To see what I'm talking about, create a simpl
by WalterBright 8y ago
> some examples?
Exception handling. EH is often sold as a "zero cost abstraction". The reality is far different. To see what I'm talking about, create a simple D (or C++) struct with a constructor and destructor. Write a simple piece of code that constructs an instance, calls some function where the implementation is hidden from the compiler, and then expect the destructor to run.
Compile it with and without EH turned on. Take a look at the code generated. You might be quite discouraged.
The existence of exceptions also significantly degrades flow analysis by the compiler optimizer, to the point where large swaths of optimizations are simply abandoned if exception unwinding may occur.