[webkit-dev] DEFINE_STATIC_LOCAL
Darin Adler
darin at apple.com
Mon Mar 29 13:59:53 PDT 2010
On Mar 29, 2010, at 1:10 PM, Eric Seidel wrote:
> http://trac.webkit.org/changeset/38411 mentions the GCC bug I was referring to. I've never seen the Radar so I don't know what it was about exactly.
I see where the confusion is coming from. The GCC bug is not the reason we have DEFINE_STATIC_LOCAL. Rather, it’s a bug that constrains the implementation of DEFINE_STATIC_LOCAL.
Originally we had a version of the macro that looked like this:
#define DEFINE_STATIC_LOCAL(type, name, arguments) static type& name = *new type arguments;
That won’t work because of the GCC bug. Instead we have this:
#define DEFINE_STATIC_LOCAL(type, name, arguments) \
static type* name##Ptr = new type arguments; \
type& name = *name##Ptr
Using a macro for this purpose both lets us have that workaround for the GCC bug and also makes it possible to experiment with other WebKit-wide changes to this static global strategy.
-- Darin
More information about the webkit-dev
mailing list