--nextPart1593202.zcEt2ZUmb6 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le dimanche 4 mai 2008, David Faure a =E9crit=A0: > I'm porting code like this > void KonqFMSettings::reparseConfiguration() > { > if (globalEmbedSettings) { > globalEmbedSettings->init(); > } > } > to K_GLOBAL_STATIC. > It used to do nothing if the singleton hadn't been constructed yet, but n= ow > it would create it just to reparse configuration, which is useless in this > case. > > How about this addition? Looks ok. Maybe it should be documented anyway. > > Index: kglobal.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- kglobal.h (revision 802526) > +++ kglobal.h (working copy) > @@ -266,6 +266,10 @@ static struct K_GLOBAL_STATIC_STRUCT_NAM > { = =20 > \ return _k_static_##NAME##_destroyed; = =20 > \ } = =20 > \ + bool exists() = =20 > \ + { = =20 > \ + return _k_static_##NAME !=3D 0; = =20 > \ + } = =20 > \ inline operator TYPE*() = =20 > \ { = =20 > \ return operator->(); = =20 > \ > > Then I could write > if (globalEmbedSettings.exists()) { > globalEmbedSettings->init(); > } --nextPart1593202.zcEt2ZUmb6 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBIHh86z58lY8jWrL0RAoF2AJ9U9FXM6MLISjMVjEdkE8wxu8cPwgCffX3K zHfBuwgBT77sauZvSmyURbo= =otub -----END PGP SIGNATURE----- --nextPart1593202.zcEt2ZUmb6--