[Development] unique_ptr and Qt, Take 2
Christian Ehrlicher
Ch.Ehrlicher at gmx.de
Thu Jun 13 23:11:43 CEST 2019
Am 13.06.2019 um 22:09 schrieb Ville Voutilainen:
>> That's one of the things I love about Qt; object hierarchies give me
>> working dynamic memory management without needing even smart pointers.
> That's the one thing that makes me queasy about using Qt in large
> applications; I always need
> to worry about ownership relationships, because I can't program with
> smart pointers. I had the pleasure
> of writing smart-pointer-only code 20 years ago; it was quite
> pleasant, especially considering that
> the largeish application was leaking like a sieve and doing
> use-after-free in all too many places.
> Once we plugged boost's smart pointers into it, all those problems
> went away over a weekend,
> and we never looked back.
A very good example on how to kill a library by simply using smart
pointer everywhere is QtXmlPatterns:
https://bugreports.qt.io/issues/?jql=project%20%3D%20QTBUG%20AND%20status%20%3D%20Reported%20AND%20component%20%3D%20%22XML%3A%20QtXmlPatterns%22%20ORDER%20BY%20key%20DESC
So simply saying 'smart pointer fix it all' is just wrong.
Christian
More information about the Development
mailing list