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