Date: Sun, 01 Oct 2023 08:14:27 -0700
On Sunday, 1 October 2023 07:32:31 PDT Giuseppe D'Angelo via Std-Proposals
wrote:
> > - Things that can require inspecting a vtable include dynamic_cast,
> > typeid, and accesses through `int D::*` pointers-to-data-member that
> > happen to point into a virtual base.
>
> Doesn't calling a non-static non-virtual member function defined in the
> virtual base also require going into the vtable, again to find where the
> virtual base subobject is, and calculate `this` for the call?
Yes, see https://gcc.godbolt.org/z/x83P78PP6.
But as I said in the other email, the use of -> already implies dereferencing
the pointer, so this is not new. The fact that most ABIs manage to place the
call to non-static member functions without dereferencing in the absence of
virtual functions and virtual inheritance is not a standard guarantee.
wrote:
> > - Things that can require inspecting a vtable include dynamic_cast,
> > typeid, and accesses through `int D::*` pointers-to-data-member that
> > happen to point into a virtual base.
>
> Doesn't calling a non-static non-virtual member function defined in the
> virtual base also require going into the vtable, again to find where the
> virtual base subobject is, and calculate `this` for the call?
Yes, see https://gcc.godbolt.org/z/x83P78PP6.
But as I said in the other email, the use of -> already implies dereferencing
the pointer, so this is not new. The fact that most ABIs manage to place the
call to non-static member functions without dereferencing in the absence of
virtual functions and virtual inheritance is not a standard guarantee.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2023-10-01 15:14:29