On 04.09.2013 17:54, Thiago Macieira wrote: > 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.
I don't confuse it, I only insisted on correct naming. Passing around a "scoped pointer" is just plain stupid. You also got the problem by your own: "Despite its name, it's not just about scope", so what is the "Scope" in the name good for? After all I would prefer QXPointer over QScopedPointer, because I could not trust the naming any more, and it's less to type. I wonder which features I haven't discovered in QWidget ;) 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. > > > > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development > _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
