nothrow in druntime win32 C bindings

Johannes Pfau nospam at example.com
Thu Dec 27 09:25:15 PST 2012


Am Thu, 27 Dec 2012 16:32:41 +0100
schrieb Andrej Mitrovic <andrej.mitrovich at gmail.com>:

> On 12/27/12, Walter Bright <newshound2 at digitalmars.com> wrote:
> > 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.
> 
> So then `nothrow` on the headers isn't enough since it only guarantees
> we're catching Exception types and letting Nothrow types through to
> Windows functions. It sounds to me like we need even stricter
> enforcement on the headers

That would probably be useful but I fear it's too late / would make the
language too complicated.

There's a similar problem in GDC:
http://gdcproject.org/bugzilla/show_bug.cgi?id=10

Right now we can't really use nothrow for optimization / we can't
simply map it to the gcc nothrow attribute. To the GCC backend it
doesn't matter if we throw an exception or an error,
__attribute__(nothrow) means the function won't throw anything.

We could of course do some advanced conservative analysis on the
function (does it call other functions, ...) but that could be done on
all functions, nothrow doesn't help there.



More information about the Digitalmars-d mailing list