From kde-core-devel Fri Jul 14 14:44:57 2006 From: Guillaume Laurent Date: Fri, 14 Jul 2006 14:44:57 +0000 To: kde-core-devel Subject: Re: Pimpl copying Message-Id: <200607141644.57441.glaurent () telegraph-road ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=115288948011589 On Friday 14 July 2006 11:55, Reinhold Kainhofer wrote: > Am Freitag, 14. Juli 2006 11:28 schrieb Lubos Lunak: > > On Friday 14 July 2006 10:33, André Wöbbeking wrote: > > > On Thursday 13 July 2006 23:05, Peter Kümmel wrote: > > > > void KTempDirTest::testBasic() > > > > { > > > > - KTempDir dir = KTempDir("test"); > > > > > > normal ctor and then copy ctor > > > > No. It's just syntactic sugar functionally completely equivalent to the > > case below with just normal ctor. If any compiler uses copy ctor here > > it's broken. > > Stroustrup's book says that > KTempDir dir = KTempDir("test"); > and > KTempDir dir("test"); > are equivalent. I.e. the first one should not use ctor and then copy. Where does it say this ? AFAIR, it says that in this case, the copy *can* be optimised away (11.7 - I'm pretty sure there are other references but I can't find them), not that it will. -- Guillaume. http://www.telegraph-road.org