Pimpl copying

Lubos Lunak l.lunak at suse.cz
Fri Jul 14 10:28:14 BST 2006


On Friday 14 July 2006 10:33, André Wöbbeking wrote:
> On Thursday 13 July 2006 23:05, Peter Kümmel wrote:
> > While debugging KTempDirTest on windows I've found that this patch
> >
> > Index: ktempdirtest.cpp
> > ===================================================================
> > --- ktempdirtest.cpp    (revision 561767)
> > +++ ktempdirtest.cpp    (working copy)
> > @@ -26,7 +26,7 @@
> >
> >  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.

>
> > +       KTempDir dir("test");
>
> normal ctor
>
> > avoids a crash caused by dereferencing a uninitialized variable.
> > (wonder why it works with gcc)

 I guess because gcc is not broken in this case.

> >
> > Or is there already a Qt way to handle this?
>
> Q_DISABLE_COPY

 Right.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/




More information about the kde-core-devel mailing list