Re: @nogc required on C API callbacks?

2014-07-11 Thread Jacob Carlborg via Digitalmars-d
On 10/07/14 21:21, safety0ff wrote: This isn't a plain old C function, it's an asynchronous signal handler. I though the signal handler was just an example and this was a more general question. -- /Jacob Carlborg

Re: @nogc required on C API callbacks?

2014-07-10 Thread Jacob Carlborg via Digitalmars-d
On 09/07/14 21:54, Brian Schott wrote: The argument for requiring @nogc on C library callbacks makes sense to me, so I'd like to know if this was intentional. Why shouldn't you be able to allocate GC memory from C? -- /Jacob Carlborg

Re: @nogc required on C API callbacks?

2014-07-10 Thread Brian Schott via Digitalmars-d
On Wednesday, 9 July 2014 at 22:20:16 UTC, Brian Schott wrote: I'll create a pull request that rearranges a few more of these attributes. https://github.com/D-Programming-Language/druntime/pull/879 Can I get somebody to look at this?

Re: @nogc required on C API callbacks?

2014-07-10 Thread safety0ff via Digitalmars-d
On Thursday, 10 July 2014 at 06:47:37 UTC, Jacob Carlborg wrote: Why shouldn't you be able to allocate GC memory from C? This isn't a plain old C function, it's an asynchronous signal handler.

@nogc required on C API callbacks?

2014-07-09 Thread Brian Schott via Digitalmars-d
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

Re: @nogc required on C API callbacks?

2014-07-09 Thread Walter Bright via Digitalmars-d
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

Re: @nogc required on C API callbacks?

2014-07-09 Thread Brian Schott via Digitalmars-d
On Wednesday, 9 July 2014 at 19:59:21 UTC, Walter Bright wrote: 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. I was talking about @nogc (added in April, so before the 2.066

Re: @nogc required on C API callbacks?

2014-07-09 Thread Brian Schott via Digitalmars-d
On Wednesday, 9 July 2014 at 19:54:11 UTC, 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

Re: @nogc required on C API callbacks?

2014-07-09 Thread Walter Bright via Digitalmars-d
On 7/9/2014 1:08 PM, Brian Schott wrote: On Wednesday, 9 July 2014 at 19:59:21 UTC, Walter Bright wrote: 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. I was talking about