K_GLOBAL_STATIC and other macros
Thiago Macieira
thiago at kde.org
Fri Apr 13 11:09:56 BST 2007
Sebastian TrĂ¼g wrote:
> While we are on it:
> What is the difference between
> Q_GLOBAL_STATIC and K_GLOBAL_STATIC?
One you can use, the other you can't :-)
Q_GLOBAL_STATIC isn't public API and Trolltech may change it for 4.4.
The other major difference is that Q_GLOBAL_STATIC creates a function for
you, whereas K_GLOBAL_STATIC creates a pointer-like object. So, you'd
write:
name()->member; // with Q_GLOBAL_STATIC
and
name->member; // with K_GLOBAL_STATIC
K_GLOBAL_STATIC objects can also be registered for ~QCoreApplication-time
destruction, whereas Q_GLOBAL_STATIC ones are destroyed only on unload.
For that reason, you also have name.isDestroyed() (note the ., not ->) in
K_GLOBAL_STATIC.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
More information about the kde-core-devel
mailing list