digitalmars.D - Documentation on D's vtable
- lurker <lurker mailinator.com> Jul 26 2010
- bearophile <bearophileHUGS lycos.com> Jul 26 2010
- Robert Clipsham <robert octarineparrot.com> Jul 26 2010
Where's the vtable layout documented? I couldn't find it in the documentation. Bonus points: How would it look like in C? Thanks
Jul 26 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
Jul 26 2010
On 26/07/10 21:56, lurker wrote:Where's the vtable layout documented? I couldn't find it in the documentation. Bonus points: How would it look like in C? Thanks
See: http://www.digitalmars.com/d/1.0/abi.html http://www.digitalmars.com/d/2.0/abi.html For D2, you can take a look at this header for how a class should look to C (look at the Object struct): http://dsource.org/projects/druntime/browser/trunk/src/rt/mars.h I believe D1 has a similar file, I'll leave you to find that yourself though :) -- Robert http://octarineparrot.com/
Jul 26 2010









bearophile <bearophileHUGS lycos.com> 