[Development] Basing Qt Creator Coding Style on C++ Core Guidelines?

Marc Mutz marc.mutz at kdab.com
Fri Dec 2 08:22:18 CET 2016

On Friday 02 December 2016 07:45:48 Tobias Hunger wrote:
> Hi Marc,
> Am 28.11.2016 15:33 schrieb "Marc Mutz" <marc.mutz at kdab.com>:
> > To see how simple gsl::owner markup is to incorporate into Qt, I sat
> down, added it to QtGlobal and marked up QScopedPointer (incl. docs) with
> gsl::owner.
> > https://codereview.qt-project.org/178107
> Owner does not work with Qt's object tree, so this seems like a pointless
> exercise to me. Having some owners but not being able to use them
> consistently is not a big win and already possible with plain C++ smart
> pointers.
> I asked Bjarne Stroustrup at Meeting C++ about Owner and object trees and
> he said that is a memory model that is not supported and that we are on our
> own there.

As you can see, I was not using it on QObject, as, indeed, the ownership there 
is messed up.

But we have tons of take*() and take()-like API, where even in auto-tests, 
which presumably were written by people that know the API well, the return 
value was ignored/leaked, making this kind of API a strong case for use of 

If the Qt low-level smart pointer do not support gsl::owner, then we impair 
users that wish to use the GSL in their own code from using it, because Qt 
code will throw false positives.


Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts

More information about the Development mailing list