This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -fvtable-gc


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]