Aaron J. Seigo aseigo at
Wed Jan 13 20:13:52 GMT 2010

On January 13, 2010, Thiago Macieira wrote:
> QWeakPointer, on the other hand, forces you to add .data(), which makes it
> clear that it's not an actual pointer. When writing the code, you're
> reminded to think "is the pointer guaranteed to be valid here?". And when
> reading it, you're reminded that something else is happening.

the very first time i used QWeakPointer i gave a small groan about this. by 
the end of the day (was converting all the Plasma related code over to this 
and some other Qt 4.6 features) I was singing a very different tune. it really 
does help, doesn't add to the verbosity of the code in practice (store and 
check the value of data() in a local var) and makes it very easy to spot 
problem code.

Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks

More information about the kde-core-devel mailing list