[Development] unique_ptr and Qt, Take 2

Konstantin Tokarev annulen at yandex.ru
Thu Jun 13 23:44:45 CEST 2019

14.06.2019, 00:14, "Christian Ehrlicher" <ch.ehrlicher at gmx.de>:
> 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

Any proffs that any of these issues were caused by smart pointers?

> So simply saying 'smart pointer fix it all' is just wrong.

Nobody says 'fix it all', smart pointers fix only specific class of issues. Without smart pointers you are on your own with them too.


More information about the Development mailing list