On Wednesday, 7 August 2013 at 07:10:21 UTC, Johannes Pfau wrote:
Am Wed, 07 Aug 2013 03:33:28 +0200
schrieb "Mike Parker" <[email protected]>:
> Maybe modifying glfwSetWindowCloseCallback and similar
> functions to only accept nothrow functions is a good idea?
I'm not sure what you mean. That's a C function, which means
it doesn't have any concept of D's nothrow. And, actually, the
callbacks should be declared as nothrow anyway. Like:
He meant declaring glfwSetWindowCloseCallback like this:
alias extern(C) nothrow void function() callback;
extern(C) void glfwSetWindowCloseCallback(callback cb);
http://dpaste.dzfl.pl/0f23146f
There's no difference in the generated code, but this way the
compiler
will complain if you pass a non-nothrow function to
glfwSetWindowCloseCallback.
Yeah, I see. I misunderstood. I agree that the callbacks should
be declared as nothrow. In Derelict, all the C function pointers
are declared as such. Apparently, I overlooked adding it to the
callbacks.