Are D classes proper reference types?

Mathias LANG geod24 at gmail.com
Sun Jun 27 23:20:38 UTC 2021


On Sunday, 27 June 2021 at 08:41:27 UTC, kinke wrote:
> On Sunday, 27 June 2021 at 07:54:38 UTC, Ola Fosheim Grøstad 
> wrote: [AFAIK, most C++ implementations put the - of course 
> totally incompatible - *C++* TypeInfo into vtable slot -1.]

Actually my understanding is that it's part of the ABI:
> Each virtual table address in the VTT is the address to be 
> assigned to the respective virtual pointer, i.e. the address 
> past the end of the typeinfo pointer (the address of the first 
> virtual function pointer, if there are any), not of the first 
> vcall offset.

[Source: Itanium ABI, 2.6.2 VTT 
Order](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-ctor-vtt)

Regarding replacing D's ABI with C++, it *might* be possible 
today, but:
- It takes someone to care about it and want it;
- It's going to be a lot of work, so it should come with lots of 
benefit - I don't see much as of now;
- It locks us in a position where we depend on an external 
committee / implementation to define our ABI.

In any case, if you feel like it's worth it @Ola, you could start 
to look into what it takes (druntime/dmd wise) and start to 
submit PR. For dlang devs questions, I recommend to use the dlang 
slack.


More information about the Digitalmars-d-learn mailing list