Functions that are CSEable but not pure

Jason Merrill jason@redhat.com
Fri Oct 12 14:35:00 GMT 2012


On 10/11/2012 03:48 PM, Alexandre Oliva wrote:
> This is not entirely clear to me; where is i defined in the first place?

Um, it's defined where the user writes the definition, like any other 
variable.

> Is it i_init that defines and tests i_initialized?

Yes.

> Consider instead the following expansion:
>
> __thread void (*i_initialize)(void) = i_init;

That would work too, though it wouldn't have the benefit of 
link-compatibility with __thread (for variables that don't need dynamic 
initialization) that the current scheme has.

I don't know whether it would be more or less efficient.

> or this:
>
> [EXTERN] __thread T *i;

Same answer.  If we aren't trying to maintain compatibility, this 
approach seems like it would be more efficient than i_initialize.

Jason



More information about the Gcc mailing list