DMD now does Dwarf style exception handling!
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 5 00:18:53 PST 2016
On Tuesday, 5 January 2016 at 01:39:51 UTC, Temtaime wrote:
> On Sunday, 3 January 2016 at 02:05:38 UTC, Walter Bright wrote:
>> On 1/2/2016 4:17 PM, Jack Stouffer wrote:
>>> What is involved in catching C++ exceptions? Was this the
>>> hard part of the whole
>>> thing?
>>
>> DMD doesn't catch them yet. But C++ on Linux throws them in
>> Dwarf format, so supporting that is the first step.
>
> Useless work.
> Almost nobody will throw exceptions from C++ code to D code.
Facebook was doing it back in 2013 and had to deal with figuring
out how to propagate them from the C++ code to the D code (which
involved catching them on the C++ side and then wrapping them to
hand over to D). So, folks have already been writing code that
would benefit from being able to have C++ exceptions go from C++
code to D code. And since the D code can't control what a C++
function is going to throw, if we don't support C++ exceptions
being caught in D, then a lot of extern(C++) functions will
really need to be wrappers which catch any C++ exceptions that
are thrown and then either handle them or hand them off to the D
code somehow. And that's a lot more work than calling an existing
C++ function for which you just write a signature for in D as
extern(C++) and then call it normally, catching an exceptions
that it throws just like you would in C++.
So, yes. This work is valuable. Whether it's the best use of
Walter's time out of all of the things he could be doing for D, I
don't know, and that's a highly subjective debate. But I don't
think that there's any question that this work is of real value
and will really help folks who want to use D but need to
integrate with existing C++ code - and that's a lot of the folks
who would be looking to use D in a professional project.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list