-fvtable-gc

Alexandre Oliva aoliva@redhat.com
Sun Feb 11 20:41:00 GMT 2001


On Feb 12, 2001, Richard Henderson <rth@redhat.com> wrote:

>   typedef void (F::*F_ptr)();
>   F_ptr baz() { return &F::foo; }

> I get an OFFSET_REF, which isn't actually documented anywhere,
> and I can't figure out what it means exactly.

Assuming F::foo is non-static (in which case you'll get a regular
pointer to function), its meaning depends on whether F::foo is virtual
or non-virtual.  &F::foo is a struct containing (i) an offset into the
vtable or a pointer to the address of the non-virtual member function,
respectively, and (ii) a displacement to be applied to the
pointer-to-object when the pointer-to-method is used to invoke the
pointed-to method.  Well, at least, it used to be something like
that.  It may have changed since the last time I looked at it, which
was long before the introduction of the new abi.  But the ideas should
still be similar.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc mailing list