[Development] The future of smart pointers in Qt API

Allan Sandfeld Jensen kde at carewolf.com
Wed Feb 12 17:08:33 CET 2020


On Tuesday, 11 February 2020 20:19:36 CET André Pönitz wrote:
> On Tue, Feb 11, 2020 at 03:15:11PM +0000, Vitaly Fanaskov wrote:
> > I want to summarize intermediate results of the discussion and return it
> > back to the track.
> > 
> > 
> > Subject: using smart pointers in the API.
> > Good idea. Better to use than not because of automatic lifetime
> > management,
> 
> *shrug*
> 
> You seem to repeat your initial statements.
> 
> QObject parents _do_ manage lifetime to start with.
> 
> > Subject: raw pointers for passing mandatory parameters vs. using
> > references.
> > Allow both approaches, recommend using references (and/or smart
> > pointers) when acceptable.
> > 
> > Not too many arguments collected here, just
> > try to make Qt API more modern.
> 
> Again only your statement.
> 
> The issue itself has been discussed over and over again.
> 
> Allowing _both_ I have not seen actively endorsed by anyone,
> this only makes a messy incosnsistent API.
> 
I would allow both. It is the only way to remain source compatible, while 
making it possible for those that wish to, to follow the so-called Core 
guidelines for C++.

'Allan




More information about the Development mailing list