Ahhh, it so hard to explain things.

Of course I am not suggesting to forbid creation of a QObject on a stack - it 
doesn’t make any sense to do that.

What I am talking about is that explicit is better than implicit. Taking an 
address of an object on a stack and passing it to a function that (possibly 
can) delete your object is not explicit. Wrapping that operation in a 
construction of a smart pointer is explicit. Moving a unique_ptr is explicit. 
When you’re «casting» your on-a-stack-QFile to a some smart pointer, you’re 
telling the compiler (and other people who read the code) «trust me, I know 
what I’m doing, this is intended».


> 4 мая 2019 г., в 0:43, Thiago Macieira <thiago.macie...@intel.com> написал(а):
> 
> On Friday, 3 May 2019 13:00:52 PDT Иван Комиссаров wrote:
>> Which should be considered bad practice and banned on an API level
> 
> No way.
> 
> Are you going to forbid creation of QFile on the stack?
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel System Software Products
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development@qt-project.org
> https://lists.qt-project.org/listinfo/development

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to