How D intercepts runtime errors
Sean Kelly
sean at f4.ca
Fri Jul 28 08:15:34 PDT 2006
Serg Kovrov wrote:
> Thanks for reply, Jarrett. It is exactly what I wondering about.
>
> * Jarrett Billingsley:
>> D, as well as most modern C++ implementations, use the underlying OS's
>> exception handling mechanisms; on Windows, it's Structured Exception
>> Handling (SEH), and on *nix, it's usually signals. I'm just going to
>> discuss SEH, as I don't know much about *nix signals, but I'd assume
>> they are fairly similar.
>
> Yes, I see microsoft c++ compiler has nonstandard keywords to support
> SEH - __try and __except. But i do not have one right now to try it out.
> In mingw/GCC's c++ compiler, on the other hand, there is no support
> (yet, I hope) for it.
>
> Need to say I haven't tried other c++ compilers, but GDC do not support
> it either. And this is really sad.
>
> Is it D language feature, or Digital Mars D compiler? Is such
> functionality part of a language standard or standard library? It would
> be nice if on all compiler implementations one could expect same behavior.
I think it would be useful to eventually standardize, as it would make
throwing exceptions across dynamic library boundaries and such much more
likely to work portably. And I think it eventually will be. Check the
bottom of the ABI:
http://www.digitalmars.com/d/abi.html
For what it's worth, DMC and DMD-Win32 both use SEH for exception
handing. If you want to look at DMD's code for this, check
phobos/internal/deh.c
Sean
More information about the Digitalmars-d
mailing list