By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

Pointer-to-member

P: n/a
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?
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Użytkownik hari4063 napisał, On 2004-01-27 09:58:
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?


Please read link below:
http://www.informit.com/isapi/guide~...de/content.asp

Paragraph:
The Underlying Representation of Pointers to Members

Best regards
Darek Ostolski
--
"C makes it easy to shoot yourself in the foot; C++ makes
it harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
Jul 22 '05 #2

P: n/a


Jul 22 '05 #3

P: n/a
Thanks!

Jul 22 '05 #4

P: n/a
void wrote:
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?


Please read link below:
http://www.informit.com/isapi/guide~...de/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

--
Best regards,
Andrey Tarasevich

Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.