Иван Комиссаров

> 31 июля 2018 г., в 21:39, Konstantin Tokarev <annu...@yandex.ru> написал(а):
> 
> 
> 
> 31.07.2018, 21:35, "Иван Комиссаров" <abba...@gmail.com>:
>> I prefer the solution from the thread "unique_ptr and Qt" about using smart 
>> pointers for transferring ownership explicitly. We can use std::observer_ptr 
>> from c++20 to indicate the places that do not take ownership.
>> I think, using gsl::owner is a wrong way of doing things, it's the way that 
>> can be source and (maybe) binary compatible, but that's a workaround, not a 
>> solution.
> 
> It's binary compatible, because owner<T> = T. It's not a solution, just 
> annotation for people static analyzers (like e.g. "emit" keyword in Qt)
> 
>> However, the solution can require too much work to do.
> 
> It also requires changic public APIs, which can only be done in Qt 6.
> 

That's why we discussing that right now, not after the qt6 will be released:)

>> 
>> Иван Комиссаров
>> 
>>> 31 июля 2018 г., в 16:04, Eric Lemanisser <eric.lemaniss...@gmail.com> 
>>> написал(а):
>>> 
>>> Please, don't introduce another type alias. It would loose the advantage of 
>>> static analysis like 
>>> http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-owning-memory.html
>>> 
>>>> Le mar. 31 juil. 2018 à 14:52, Giuseppe D'Angelo via Development 
>>>> <development@qt-project.org> a écrit :
>>>> Hi,
>>>> 
>>>>> On 31/07/18 13:11, Sérgio Martins via Development wrote:
>>>>> I would recommend however that our docs show T* instead of gsl::owner<T>
>>>>> and continue to include "Takes ownership of foo" in the text.
>>>>> While I believe in self-documenting signatures I think it's too much
>>>>> noise and hurts readability, and most devs never heard of gsl.
>>>>> 
>>>>> Should be just an aid for tooling IMO.
>>>> 
>>>> I agree with the rest of your email, but I kind of disagree with this
>>>> particular point, for different reasons:
>>>> 
>>>> * Because we need to educate our users that there's more C++ than Qt out
>>>> there, and the Core Guidelines and the GSL are a fundamental part of
>>>> knowledge for a C++ developer.
>>>> 
>>>> * Even if we consider talking about the GSL too much of a "distraction"
>>>> in the docs, we can simply add our own qOwner type alias, with identical
>>>> semantics, and document what it does and what it means in signatures.
>>>> 
>>>> * Leaving gsl::owner in the signature of a function documentation can
>>>> help clarify situations where the textual documentation does not say
>>>> anything about the ownership. At least, it's one more safeguard against
>>>> adding functions that take/return pointers and don't clearly document
>>>> the ownership.
>>>> 
>>>> However, from a practical point of view, unless someone adds gsl::owner
>>>> _everywhere_ to Qt, we can't report it in the docs, as they would
>>>> otherwise be inconsistent :-(
>>>> 
>>>> My 2 c,
>>>> --
>>>> Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
>>>> KDAB (France) S.A.S., a KDAB Group company
>>>> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
>>>> KDAB - The Qt, C++ and OpenGL Experts
>>>> 
>>>> _______________________________________________
>>>> Development mailing list
>>>> Development@qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/development
>>> _______________________________________________
>>> Development mailing list
>>> Development@qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/development
>> ,
>> 
>> _______________________________________________
>> Development mailing list
>> Development@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
> 
> 
> -- 
> Regards,
> Konstantin
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to