Ignorant question about printf warnings for pointer-to-member functions
Michael Matz
matz@suse.de
Mon Dec 2 06:12:00 GMT 2002
Hi,
On Sat, 30 Nov 2002, Matthias Benkmann wrote:
> p.s.: It would be very nice if someone could give a (pointer to a) brief
That's a detail of the C++ ABI, and ergo is specified here:
http://www.codesourcery.com/cxx-abi/abi.html#member-pointers
> explanation of how GCC implements member pointers. Is it the same
> structure for data members and methods, virtual and non-virtual?
Well, data members are not virtual or something, so a simple address is
enough to describe pointers to data members. And pointer to member
functions are composed of a pointer, which holds a normal (C) function
pointer in case of pointing to a non-virtual function, or a vtable offset
+ 1 for a virtual function, and an adjustement field for the this pointer.
Note, that what is a "normal" function pointer is also architecture
specific, and can differ quite much from a simple data pointer (e.g. for
itanium it's a pointer to a pair of a function address (into the .text
section) and the GP value.
Ciao,
Michael.
More information about the Gcc
mailing list