On Monday, 27 June 2016 at 16:48:16 UTC, Ola Fosheim Grøstad wrote:
On Monday, 27 June 2016 at 16:38:07 UTC, luminousone wrote:
easy to implement. In C++ the exact position of the vtable depends on what is in the base most class, it might be 8bytes in, maybe 20, maybe 200, you just don't know, And certainly the runtime can't know.

I know what the usual implementation is, but I don't believe it is required by the spec. So it is implementation defined and the runtime most certainly can know if that is part of the requirement. As I said, you don't even need to use a vtable AFAIK.

Can show me the section in the spec where it is required? I can't find it.

Its the nature of being compatible with C, it might not be explicitly stated in the spec, but the only place to put the vtable pointer and stay compatible with C structs is at the end. You will notice in D you can't inherit from a struct, this isn't merely design choice.

Reply via email to