nothrow in druntime win32 C bindings

deadalnix deadalnix at gmail.com
Thu Dec 27 01:52:44 PST 2012


On Thursday, 27 December 2012 at 09:29:08 UTC, Walter Bright 
wrote:
> On 12/27/2012 12:52 AM, deadalnix wrote:
>> On Thursday, 27 December 2012 at 01:39:11 UTC, Walter Bright 
>> wrote:
>>> This applies to any attempt to throw D exceptions in code 
>>> called by non-D code.
>>
>> BTW, Why D isn't using the system defined exception ABI if one 
>> exists (like on
>> windows) ? Is-it intentional, or lack of 
>> documentation/manpower ?
>
> 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.


More information about the Digitalmars-d mailing list