473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Pointer-to-member

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
4 1923
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


Jul 22 '05 #3
Thanks!

Jul 22 '05 #4
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rasti | last post by:
Hello, I am trying to translate a C++ script to Java. Are there any differences between the C++ this-pointer and the Java this-pointer? Thank you
5
by: | last post by:
What is the difference between passing argument by reference or by pointer? Is there any difference in terms of PERFORMANCE ? When and why one of these method (by reference or by pointer) should be...
20
by: __PPS__ | last post by:
Hello everybody in a quiz I had a question about dangling pointer: "What a dangling pointer is and the danger of using it" My answer was: "dangling pointer is a pointer that points to some...
20
by: joe | last post by:
Hi all! I just have quick, possibly stupid question.... is it possible to do the following: int func(){ int *pointer; foo(pointer); } int foo(int *pointer){
20
by: Bill Potter | last post by:
I am a learning programmer in C and i want to know why some one would use pointers instead of going direct!
4
by: code break | last post by:
Hi all, What is the difference between stack pointer and frame pointer ? Any suggestions are welcome ,,,
6
by: reji_thomas | last post by:
Hi, I have a doubt in the following code: struct xyz { int x; long l; float f; };
13
by: william | last post by:
code segment: long int * size; char entry; ............. size=&entry; ************************************* Gcc reported 'assignment of incompatible pointer type'.
34
by: sumedh..... | last post by:
double * X size of X->?? size of X->?? double (*X) size of X->?? size of X->??
8
by: Rahul | last post by:
Please read the following code class Test{ public: void * operator new (size_t t) { return malloc(t); } void operator delete (void *p) { free(p); } };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.