Should C functions automatically be nothrow?

Martin Nowak dawg at
Tue Feb 7 16:47:05 PST 2012

On Tue, 07 Feb 2012 20:53:45 +0100, Walter Bright  
<newshound2 at> wrote:

> On 2/7/2012 5:40 AM, Stewart Gordon wrote:
>> On 07/02/2012 02:04, Jonathan M Davis wrote:
>>> Can C functions throw? I don't know of any way that a C function could  
>>> throw.
>> <snip>
>> On top of what the others have said, functions written in C can  
>> certainly throw
>> such things as AVs.
> Although seg faults are converted into D exceptions on Windows by  
> druntime, and so can be caught, I suspect this was not a good idea. It's  
> completely non-portable to other systems.
> Nor would C code do such a conversion anyway.

I'm not a big fan of translating async exceptions which causes enough bad  
usage in C++ land.
We're translating them to Errors though.

Visual C++ allows to switch between different EH models

More information about the Digitalmars-d mailing list