Getting rid of global objects in kdevplatform/language

Andreas Pakulat apaku at gmx.de
Fri May 14 11:16:14 UTC 2010


On 14.05.10 10:18:49, Esben Mose Hansen wrote:
> On Friday 14 May 2010 00:41:34 Andreas Pakulat wrote:
> > Opinions?
> 
> +1. Function-static objects are an abomination in all but a few cases, and the 
> performance hit seems well worth the gains.

I think you partly misunderstood. I've changed from this (in xxx.cpp):

RepositoryManager<....> identifierRepository("foobar");

to this:

static RepositoryManager<...>& identifierRepository() {
  static RepositoryManager<....> identifierRepositoryObject("foobar");
  return identifierRepositoryObject;
}
 
So I _introduced_ function-static objects to replace global static objects
(or non-static in this case).

Andreas

-- 
You'll feel devilish tonight.  Toss dynamite caps under a flamenco dancer's
heel.




More information about the KDevelop-devel mailing list