Le 07/02/2012 03:04, Jonathan M Davis a écrit :
Can C functions throw? I don't know of any way that a C function could throw.
Is it possible if you have a C function which calls a D function or something
like that? I don't know. I wouldn't really expect the C function to be able to
handle the D exception, in which case, it wouldn't end up throwing the
exception to whatever code calls it.
Assuming that C functions can't throw, is there any reason _not_ to have the
compiler automatically treat C functions as nothrow?
If we can't treat C funtions in general as nothrow (for whatever reason that
may be), is there a reason why we can't explicitly mark the various C bindings
in druntime as nothrow at the very least?
- Jonathan M Davis
extern(C) goes in both directions. D can call C, but C can call D. And D
can throw exceptions. So you can end up with extern(C) function that
throw exceptions.