nothrow in druntime win32 C bindings

Walter Bright newshound2 at digitalmars.com
Wed Dec 26 19:14:33 PST 2012


On 12/26/2012 6:26 PM, Andrej Mitrovic wrote:
> On 12/27/12, Walter Bright <newshound2 at digitalmars.com> wrote:
>> Windows knows nothing about D exceptions
>
> Then why does my code sample work?

A lot of code can appear to work, but that doesn't mean it is correct and robust 
and will work on future versions of Windows. Code should not impute things into 
an ABI spec. The Windows ABI spec says nothing at all about accepting D 
exceptions, therefore none should be presented to it.


> If Windows really knows nothing about D exceptions why are we letting
> Error and Throwable through, shouldn't we also catch those and then
> call core.stdc.exit() or ExitProcess()?

Take a look at druntime\src\rt\dmain2.d. It catches all Throwable's and swallows 
them - it does not expect the C runtime to handle D exceptions. This is why 
Throwable is still catchable.



More information about the Digitalmars-d mailing list