a text on optimizing C++

David Leimbach kde-optimize@mail.kde.org
Fri, 24 Jan 2003 07:18:38 -0600


>  It looks almost the same, but the latter may also sometimes produce
> shorter code. Upon entering the constructor body, all constructors of
> attributes have already been executed. So in this example, in the latter
> case attr2 is directly initialized using a copy constructor, while in the
> sooner case it's initialized using the default constructor, and then
> operator= is used.

So your claim is that with the initializer list the following has a shorter 
execution path?

SomeClass obj = someOtherObj;

I don't think operator = is involved at all in the above line of code 
regardless of whether the constructor uses initializer lists or not.  The 
above is *not* an assignment so why would it use the assignment operator?  
The above is an initialization that just happens to use the '=' token.

At least I think that's correct... I know this comes up on newsgroups from 
time to time [comp.lang.c++.moderated] so I will google there. :)


Dave Leimbach