Any libunwind experts n da house?

IgorStepanov via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 13:31:01 PDT 2014


On Saturday, 27 September 2014 at 20:18:42 UTC, Andrei 
Alexandrescu wrote:
> On 9/27/14, 12:53 PM, IgorStepanov wrote:
>> On Saturday, 27 September 2014 at 18:33:24 UTC, Jacob Carlborg 
>> wrote:
>>> On Saturday, 27 September 2014 at 11:34:32 UTC, IgorStepanov 
>>> wrote:
>>>
>>>> C++ exception mechanism uses C++ type_info objects. We can 
>>>> inherit
>>>> object.Throwable from std::exception (through extern(C++) 
>>>> interface),
>>>> override the what() method, but there are no way to generate 
>>>> C++
>>>> type_info for D class now. If we want to do a compiler 
>>>> support of C++
>>>> exceptions, we should implement and support another one
>>>> non-standartized feature: type_info. BTW it allows to do 
>>>> dynamic_cast
>>>> over C++ classes in D, but I think, nobody approve this 
>>>> suggestion,
>>>> because it can be hard).
>>>
>>> Objective-C can do it somehow. If they can do it I'm sure we 
>>> can as well.
>>>
>>> --
>>> /Jacob Carlborg
>>
>> If someone from D commanders bless me, I can start to 
>> exploring and
>> implementing std::type_info for D classes. If we made it, we 
>> will
>> implement 50% of C++ exception handling.
>
> Would that be for throwing exceptions from D into C++? I think 
> we can postpone that for now. -- Andrei

No, that for throwing from C++ into D: for catch an exception, we 
should pass type_info object to special C++ runtime function. C++ 
runtime determines, can throwed object type can be casted to 
asked type, and if yes - allow catch it and do catcher code. If 
you will see the my example, you will see that I do this 
manually: get throwed type_info and compare its mangle with 
requested mangle. If we will make it as possible, it will be work 
better, faster and  reliable. As bonus: possibility to implement 
dynamic_cast over C++ classes.


More information about the Digitalmars-d mailing list