nothrow in druntime win32 C bindings

Walter Bright newshound2 at digitalmars.com
Thu Dec 27 10:04:45 PST 2012


On 12/27/2012 1:52 AM, deadalnix wrote:
> On Thursday, 27 December 2012 at 09:29:08 UTC, Walter Bright wrote:
>> D does use Windows SEH for win32, but not for win64. But still, you gotta ask
>> yourself, what do expect Windows to do with a D exception?
>
> I think it has several advantages to use the same ABI :
>   - Exception cal bubble from D to C++ then back to D to be handled. C++ will
> run RAII code properly, even if it can't do anything useful with the D
> exception. This is common when using function pointer or virtual methods.
>   - The same thing goes the other way around : C++ Exception can go throw D
> code, unwinding stack cleanly. Even if D program cannot do anything really ith
> the C++ exception, it can at least fail safely and with a stack trace.
>
> In many cases, exception are more about exit cleanly than actually catch them
> and recover. For such a case, common ABI is useful.

There is some merit to your argument, and that was the original idea behind 
building D exceptions out of Win32 SEH. I did the same for the Digital Mars C++ 
compiler.

But in practice, and I include a decade with DMC++, I've just never seen a 
useful application of it.


More information about the Digitalmars-d mailing list