On quarta-feira, 4 de setembro de 2013 10:20:39, Peter Kümmel wrote:
> > What's that something else? Remember that QScopedPointer was created to
> > simplify handling of exceptions (when we tried to care about exceptions).
> > If we have to take the pointer out and handle it manually, it defeats the
> > entire purpose of QScopedPointer -- simplifying exception management.
> 
> This "something else" we have to introduce in Qt (it would be very similar
> to QScopedPointer), because initially QScopedPointer wasn't made for it,
> and all "escaping from scope" questions if QScopedPointer is the right
> choice at this place.

You're confusing QScopedPointer's purpose. Despite its name, it's not just 
about scope. It's about simplifying the handling of the pointer's deletion 
when an exception is thrown.

Taking the pointer out via take() and storing it in a raw pointer defeats that 
purpose.

        q.reset(p.take()); is exception-safe
        return p.take();  isn't

if we want to return exception-safely, we need this.

Note: we don't care anymore about exceptions.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to