On Wednesday, 7 September 2016 at 20:55:52 UTC, Walter Bright
wrote:
On 9/7/2016 5:07 AM, Ethan Watson wrote:
But ignoring that. My first member is offset by 8 bytes, even
in an extern( C++
) class. I assume it's just blindly sticking a vtable in there
regardless of if
I actually define virtual functions or not.
This came up before with Manu's desire to match complex C++
hierarchies that are, in essence, multiple inheritance even if
they didn't look like multiple inheritance. D only supports
multiple inheritance as interfaces. Having C++ classes with no
_vptr means multiple inheritance (I know this isn't obvious
why, but if the details are worked through it is inevitable.)
He is not the only one. I raised that has the n°1 problem I had
when interfacing with C++ years ago. Even made a proposal.
It is clear at this point that structures with obligatory
initialization are necessary. For C++ but not only. Right now,
all dtors need to make sure that the .init state is valid, which
can be a performance problem (you need to add runtime checks to
know if you actually need to destroy a resource).