Re: [sv-ec] When are derived class data members created?

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Apr 23 2007 - 14:53:19 PDT
I don't think I am going to try to answer everything in here.

I expect that SV should essentially follow C++ construction
which means (essentially) that the effective virtual function
table changes during the course of construction.  The
"Quote 3" response isn't technically correct -- this isn't
"turning off" the virtual mechanism, it is just setting
the vtbl to the vtbl that corresponds to the class type
of the level of inheritance that is being constructed.
That is why C++ says "or in one of its bases" -- you can
get a virtual invocation but the method invoked depends
on that static type of the "new" that you are in, not
the dynamic type of the actual object being constructed.

I know of at least one SV implementation that for the
testcase produces the same result as C++:
   base::base()
   base::initialize()
   derived::derived()
   base::initialize()
   derived::initialize()

Gord.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Apr 23 14:53:16 2007

This archive was generated by hypermail 2.1.8 : Mon Apr 23 2007 - 14:53:34 PDT