Documentation on D's vtable

bearophile bearophileHUGS at lycos.com
Mon Jul 26 14:10:05 PDT 2010


lurker:
> Where's T documented? I couldn't find it in the documentation.
> Bonus points: How would it look like in C?

There are two groups of specs, the D language specs, and the specs of how dmd compiles D code. The vtable layout is a dmd spec, because in theory other D compilers can implement virtual functions in another ways (for example with dispatch tree, that are better for inlining, but have other disadvantages).

D language specs show that D classes have the .__vptr and .__monitor properties, but I think the vptr can be just a ID pointer if a compiler implements virtual calls with dispatch trees, because there is no need of a virtual table.

Bye,
bearophile


More information about the Digitalmars-d mailing list