[Digikam-devel] Re: delete does not reset the pointer in GCC (4.6.0)
Marcel Wiesweg
marcel.wiesweg at gmx.de
Wed Jun 15 21:25:05 BST 2011
> > Right, we are still using too many raw pointers.
> > Qt, C++ stdlib and boost have many things to handle pointers
> > automatically.
>
> Yes. this one is exactly that we need :
>
> http://doc.qt.nokia.com/4.7/qpointer.html
QPointer is good for QObject pointers, but works only with them
Where applicable, "value" classes can be built around implicit sharing
(QSharedDataPointer), like DImageHistory recently. It's some lines extra but
100% safe to crashes if the class itself checks for 0. Of course, there is
overhead for the extra allocation, but almost all Qt value classes are built
around this pattern, beginning with QString or QByteArray.
More information about the Digikam-devel
mailing list