Should C functions automatically be nothrow?

Jonathan M Davis jmdavisProg at
Mon Feb 6 18:04:55 PST 2012

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

More information about the Digitalmars-d mailing list