[Development] Making QScopedPointer scoped (again)

Stephen Kelly stephen.kelly at kdab.com
Wed Sep 4 09:39:38 CEST 2013


On Tuesday, September 03, 2013 14:00:39 Thiago Macieira wrote:
> [1] http://isocpp.org/files/papers/n3740.pdf

Some quotes from the pdf:

> In addition to the technical benefits of such smart pointers, their names 
provide de facto vocabulary types

That is, names are important, and should match what the smart pointer does. In 
Qt 5.2, QScopedPointer is no longer scoped. That is bad.

> or describing certain common coding idioms that encompass pointer-related 
policies such as pointee copying and lifetime management.

One would expect the lifetime of a scoped pointer to be determined by the 
scope. In Qt 5.2, that is no longer the case with QScopedPointer, though it 
has been the case up to 5.1.

> As a result [of using bar pointers], it has often proven to be very 
challenging and time-consuming for a programmer to inspect code in order to 
discern the use to which any specific bare pointer is put, even if that use 
has no management role at all

Similarly, if a scoped pointer may or may not be scoped, what can the 
programmer determine by inspecting the name of it?

Thanks,

-- 
Join us in October at Qt Developer Days 2013 - https://devdays.kdab.com

Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130904/6f728183/attachment.sig>


More information about the Development mailing list