Re: Is gcc allowed to eliminate writes in a destructor?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 June 2015 at 12:47, Norbert Lange wrote:
> if you mean vtable gets altered you mean the pointer is directed to
> another vtable?

Yes.

I should have said the vptr is altered, to refer to a different vtable.

What I mean by "there's only one vtable" is that an object has a
single vptr, to a single vtable. Which vtable it points to depends on
what stage of its lifetime it is at.

During construction of the Base sub-object the object will somewhat
look like this:

&VTableBase
[members of Base]
[uninitialized storage for members of Derived]

then when the Derived constructor runs it looks like this:

&VTableDerived
[members of Base]
[members of Derived]

After ~Derived() completes:

&VTableBase
[members of Base]
[uninitialized storage for members of Derived]

and after ~Base() completes the object is no more.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux