[Development] Q_GLOBAL_STATIC_WITH_INITIALIZER is harmful: please stop using it! (long)
Thiago Macieira
thiago.macieira at intel.com
Fri Mar 16 13:00:59 CET 2012
On sexta-feira, 16 de março de 2012 12.38.57, Thiago Macieira wrote:
> Type *object()
> {
> static Type *pointer;
> if (!pointer) {
> pointer = new Type;
> initializer
> }
Add here:
return pointer;
> }
>
> that is equally as thread-safe as the macro. And it's a lot more readable.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
Intel Sweden AB - Registration Number: 556189-6027
Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120316/8f938c6b/attachment.sig>
More information about the Development
mailing list