Getting rid of global objects in kdevplatform/language

Benjamin Schindler bschindler at inf.ethz.ch
Fri May 14 13:23:20 UTC 2010


On 05/14/2010 03:01 PM, David Nolden wrote:
> The problem is that like that, actually the creation of the
> repositories is _even less_ well-defined. Before, it was always
> created on shared-library loading, and now it will be created on
> first-use, which may be whenever. For example, if some component uses
> an IndexedString before you manually initialize the repository, it
> will be initialized automatically and wrongly at some random point in
> time.
> 

While I'm still not entirely familiar with the internals, the thing
about the well-definedness is not really true.
I'm sure you know the static-initialization fiasco - when you statically
initialize data, there is no way to tell which is going first. By having
static variables in functions, it lets you actually initialize A before
B if B depends on A. With just static variables, that's not possible. So
the order is actually more defined...

Just my 2 cents




More information about the KDevelop-devel mailing list