www.digitalmars.com         C & C++   DMDScript  

D - Object's memory layout

reply Stephan Wienczny <wienczny web.de> writes:
Hallo Walter,

could you please tell us how a vtbl of an D object looks like?
Object's vtbl has 6 elements
I would assume:
this()
void print()
char[] toString()
uint toHash()
int opCmp(Object o)
int opEquals(Object o)

If that's correct why do you have a special pointer to the destructor?
What does the init value, inside ClassInfo, do?

Stephan
Mar 18 2004
parent "Walter" <walter digitalmars.com> writes:
"Stephan Wienczny" <wienczny web.de> wrote in message
news:c3dh25$2gk9$1 digitaldaemon.com...
 Hallo Walter,

 could you please tell us how a vtbl of an D object looks like?
 Object's vtbl has 6 elements
 I would assume:
 this()
 void print()
 char[] toString()
 uint toHash()
 int opCmp(Object o)
 int opEquals(Object o)

obj2asm yields pretty good info on this <g>. But the vtbl[] is pretty simple - the first entry is the address of the classinfo, and the rest are the virtual functions, in order.
 If that's correct why do you have a special pointer to the destructor?

It doesn't.
 What does the init value, inside ClassInfo, do?

Provides the .init property value for the class object, which is the default initialization for each of the members.
Mar 18 2004