Should C functions automatically be nothrow?
Johannes Pfau
nospam at example.com
Wed Feb 8 00:03:50 PST 2012
Am Tue, 7 Feb 2012 12:31:06 -0800
schrieb "H. S. Teoh" <hsteoh at quickfur.ath.cx>:
> On Tue, Feb 07, 2012 at 11:53:45AM -0800, Walter Bright 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.
> [...]
>
> I was going to suggest using siglongjmp() and doing stack-unwinding in
> the SEGV signal handler on Posix systems, but apparently this is very
> very evil because subsequent code will still be running in the signal
> handler's context and any call to signal-unsafe functions will cause
> undefined behaviour.
>
> So yeah. Bad idea. :)
>
>
> T
>
Does libsigsegv have the same restrictions or how is it implemented?
More information about the Digitalmars-d
mailing list