[Patch] Fix undeleted "static QFont *_font" in kglobalsettings.cpp
Matthias Kretz
kretz at kde.org
Thu Dec 4 16:46:47 GMT 2008
On Thursday 04 December 2008 16:59:19 Friedrich W. H. Kossebau wrote:
> Am Donnerstag, 4. Dezember 2008, um 14:41 Uhr, schrieb Thiago Macieira:
> > On Thursday 04 December 2008 14:16:15 Friedrich W. H. Kossebau wrote:
> > > inline GlobalSettingsData* GlobalSettingsData::self()
> > > {
> > > K_GLOBAL_STATIC(GlobalSettingsData, s_self)
> > > return s_self;
> > > }
> >
> > Don't put K_GLOBAL_STATIC inside a function.
>
> Why?
>
> At least I can't find a reason in the definition of
> K_GLOBAL_STATIC/K_GLOBAL_STATIC_WITH_ARGS.
The "static" keyword has a different meaning in the global scope and in a
function local scope. K_GLOBAL_STATIC expects to be in the global scope and
uses "static" that way. OTOH looking at it with objdump the only difference I
can find is the additional namespacing when inside a function.
Thiago, do you have any good reason other than the name?
> And it seems to have worked for KGlobalSettings* KGlobalSettings::self()
> in KDE 4.{0,1}.
>
> If there is a reason it should be added to the APIDOX, please.
It's in the name: _global_ static. Seeing K_GLOBAL_STATIC in a function local
context always looks like a contradiction to me. :)
Regards,
Matthias
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
More information about the kde-core-devel
mailing list