Why exceptions for error handling is so important

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 13 15:40:40 PST 2015


On Tuesday, 13 January 2015 at 22:46:26 UTC, Ola Fosheim Grøstad 
wrote:
> Of course the best solution might be to just implement 
> reasonably fast exceptions by:
>
> 1. Restricting the exception object to 512 bytes, preallocated 
> in TLS.
>

Exception can bubble from one thread to another.

> 2. Only have one exception in flight per thread
>

I don't see how you could have more.

> 3. Require that the first 8 bytes of the exception buffer are 0 
> when no exception is in flight, and use them for encoding 
> exception type when one is in flight.
>

The first 8 bytes are already what is used to do matching. But, 
because of inheritance, it is not as simple as you think it is. 
Also, who the fuck care what is in the buffer when no exception 
are in flight ?

Skipping 4 and 5, you obviously didn't though that through.


More information about the Digitalmars-d mailing list