Pointer-to-member

H

hari4063

Hay,
I decalre pointer-to-member and it's sizeof iz 12 (in Borland 5) or 4 (in MinGW)? When I debugged code, only parameters pushed on stack is 'this' and call was indirect?
What other 2 dwords are?
 
A

Andrey Tarasevich

void said:
Please read link below:
http://www.informit.com/isapi/guide~cplusplus/seq_id~137/guide/content.asp

Paragraph:
The Underlying Representation of Pointers to Members
...

Hmm... The above text doesn't explain much and also it contains the
following statement

"Thus, the simplest member function can be represented as a set of two
pointers: one holding the physical memory address of the member
function, and a second pointer that holds the 'this' pointer."

This is, of course, incorrect. Member function pointers in C++ are not
tied to any concrete object and, therefore, do not need to store any
'this' pointers.

In one popular implementation on a 32-bit platform a 8-byte member
function pointer holds two values: a entry point to the function and a
"delta" value used by pointer conversions in hierarchies with multiple
inheritance (adjusting 'this' pointer). This could be exactly what the
author of the above article meant (although I seriously doubt that), but
the current wording is definitely misleading
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top