@nogc required on C API callbacks?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 9 12:59:21 PDT 2014


On 7/9/2014 12:54 PM, Brian Schott wrote:
> https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/signal.d
>
>
> When @nogc was added to the top of that file, the type of sigfn_t changed from
> "void function(int) extern (C) @system nothrow" to "void function(int) extern
> (C) @system nothrow @nogc".
>
> This breaks some code such as the ae library used by Digger. (The @nogc
> annotation is now required on signal handlers). The argument for requiring @nogc
> on C library callbacks makes sense to me, so I'd like to know if this was
> intentional.

I agree that callbacks shouldn't throw. The problem is existing code uses 
callbacks that aren't annotated with 'nothrow', and we don't like breaking all 
their code.


More information about the Digitalmars-d mailing list