Re: C++ extension

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

 



Supposed you have two constructor which initialize differently one
member of a class. If you provide a default initialization you call a
constructor, then you call a second constructor or a copy
constructor/assignment operator in your constructor. The override of
the default value cost the call of two constructors instead of one.

On 4/20/06, Perry Smith <pedz@xxxxxxxxxxxxxxxx> wrote:
> I don't understand what you are saying.
>
> If you have several constructors, you have to initialize each member
> in each constructor or have one common constructor.
>
> If the new syntax was allowed, you could still do that.  You could
> specify how to initialize it when the member is declared or you could
> specify it with each constructor.  I'm not suggesting replacing the
> current syntax -- just adding to it.
>
> Perry
>
> On Apr 20, 2006, at 2:31 AM, Olivier Delannoy wrote:
>
> > No it's not better because if you have several constructors, the
> > initial state of the object does not have to be defined several time,
> > one time globally and one time in the constructor. In the case of
> > complex object, creating a temporary unused object is not interesting.
> > The constructor is the place where you should initialize object
> > states. The current way to do stuff is the more efficient way for C++.
> >
>
>


[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