This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: two constructor copies question, again
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: "Clint Laschkewitsch" <clintl at us dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 26 Jan 2003 05:18:37 -0200
- Subject: Re: two constructor copies question, again
- Organization: GCC Team, Red Hat
- References: <OFA6633EA2.2EA2D4C9-ON86256C7C.0065A2C3@rchland.ibm.com>
On Nov 25, 2002, "Clint Laschkewitsch" <clintl@us.ibm.com> wrote:
> On Jan 16, 2002 Rogeleio M Serrano Jr. asked why there were two copies of a
> constructor being generated in the object file.
> Alexandre Oliva responded that one was for full-object construction and one
> was for sub-object construction.
> Could you please clarify for me what you mean by sub-object?
The base-class part of a full object is a sub-object.
> Is another constructor needed if the first class is sub-classed?
Yes, if there is virtual inheritance involved.
> And if so, why? What is the problem being solved?
Because the C++ Standard says that it is the most-derived class that
gets to initialize all virtual sub-objects.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer