D 1.076 Alpha for Windows 64 bits, works with VS 2010
Jonathan M Davis
jmdavisProg at gmx.com
Sat Sep 29 04:01:59 PDT 2012
On Saturday, September 29, 2012 06:41:01 Nick Sabalausky wrote:
> On Fri, 28 Sep 2012 18:20:12 -0700
>
> Brad Roberts <braddr at slice-2.puremagic.com> wrote:
> > On Fri, 28 Sep 2012, Walter Bright wrote:
> > > True, but I would never write code that tried to throw an exception
> > > across language boundaries, anyway. It's just asking for trouble.
> >
> > And that's fine for your code, but if you want D and DMD to be a
> > system that people use for larger systems, then cutting down the
> > sheer number of things that don't work when pushed is kinda important.
>
> Especially since one of D's big selling points is linking with C/C++
> code.
>
> If such linking causes trouble with exceptions then people are
> going to think twice about trying it (which reduces a major inroad for
> D), or discover by surprise that it doesn't work and get
> frustrated/annoyed.
It's a problem that I've run into at work between C++ and the C# interop layer
for one of our programs. A .NET bug with regards to C++ exceptions being
thrown from C++ code resulted in destructors not being run when they were
caught in the managed C++ code (and that's the _managed C++_, not even C#).
Mutexes weren't being unlocked as a result, and it wasn't pretty. Making sure
that exceptions didn't escape the normal C++ code would have fixed it, but we
shouldn't have had to do that. It may be a relatively rare issue, but it _is_
something that can cause bugs.
That being said, it probably _is_ better practice to make sure that you catch
all exceptions at language barriers, even if they both use exceptions, but
still, you know that some people are going to try and have exceptions cross
those barriers, and if it doesn't work, they'll have bugs (and bugs which
could be very hard to find depending). So, in the long run at least, it would
be very desirable to have this compatability issue resolved.
- Jonathan M Davis
More information about the Digitalmars-d-announce
mailing list