nothrow function callbacks in extern(C) code - solution

Paolo Invernizzi via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 04:07:47 PDT 2014


On Thursday, 19 June 2014 at 19:58:58 UTC, Walter Bright wrote:

<snip>

> The callback function, being supplied by the D programmer, may 
> throw and may call the garbage collector. By requiring the 
> callback function to be also nothrow @nogc, this is an 
> unreasonable requirement besides breaking most existing D code 
> that uses qsort().

<d.learn>

I'm missing something, as I'm annotating all my C/API/etc 
callback function with nothrow: when the callback throws, what 
happens?

I was thinking that this will mess-up the stack once the unwind 
will proceed...
What's the use-case for having such a callback 'throwable'?

Thanks!

</d.learn>

---
Paolo


More information about the Digitalmars-d mailing list