C++/D interface: exceptions

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 12 15:50:49 PDT 2014


On Friday, 12 September 2014 at 17:57:41 UTC, Marc Schütz wrote:
>
> Btw, how does implicit conversion work with `catch` in C++? 
> I.e., if you throw a `char*`, will it be caught when you catch 
> `const char*`? This can not be handled easily with such a 
> template, as we would need to catch both 
> `CppException!(const(char)*)` and `CppException!(char*)`.

I'm hoping it's simply a matter of sticking the right data in a
lookup table and letting the C++ runtime figure out what the
proper match is for us.

D currently has a custom mechanism for throwing on non-Windows
platforms, but it may be worth switching to the established C++
approach, provided we can do so without losing anything (and this
is a big "if" given how we implicitly chain exceptions).


More information about the Digitalmars-d mailing list