On 7/2/06, Gary Funck <[EMAIL PROTECTED]> wrote:
...
Seongbae Park wrote:
> Because the compiler has to generate different code
> for accesses to __thread vs non __thread variable
In my view, this is implementation-defined, and generally can vary
depending upon the underlying linker and OS technology. Further,
there is at least one known platform (IA64) which seems to not impose
this restriction. A few implementation techniques come to mind,
where the programmer would not need to explicitly tag 'extern's
with __thread:
That's the only platform I know of that doesn't require different sequence.
Should we make the language rules such that
it's easy to implement on one platform but not on the others,
or should we make it such that it's easy to implement in almost all platforms ?
Also, what is the benefit of allowing mismatch between
declaration and definition of __thread vs non __thread ?
It only makes reading the code more difficult
because it confuses everybody - you need to look at the definition
as well as the declaration to know whether you're dealing
with a thread local variable or not which is BAD.
...proposed scheme snipped...
The question to me is not whether it's doable, but whether it's worth doing
- I see only downside and no upside of allowing mismatch.
If you're convinced that this is a really useful thing for a
particular platform,
why don't you create a new language extension flag that allows this,
and make it default on that platform ?
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"