[webkit-dev] Atomic Strings and static vars

Darin Adler darin at apple.com
Mon Jun 5 13:43:13 PDT 2006


On Jun 5, 2006, at 12:14 PM, Mike Emmel wrote:

> the problem with global statics is technical and has to do with the  
> order or lack thereof of the static constructors

I'm not sure what you mean.

For our frameworks for Mac OS X we have a constraint for performance  
reasons, entirely separate from the static initialization order  
issue. Because of that constraint, the WebKit project rule is "no  
static initialization at all".

Yes, there are some technical issues about doing global static  
initialization right. But in this project we avoid them since we  
don't have any for the above reason.

> In this case one is missing and in any case order is never assured  
> technically the static constructor may be on the wrong class. My  
> opinion is you may want to fix the core classes to actually work  
> correctly with global statics

I don't think we want to do this, again for performance reasons.

We don't want to pay for a global variable fetch and a branch when  
creating each AtomicString to check to see if the global  
initialization has been done yet. Instead, we have chosen the  
approach of not using AtomicString until after the AtomicString::init 
() function is called.

     -- Darin




More information about the webkit-dev mailing list