Boost logo

Boost :

From: Ken Hagan (K.Hagan_at_[hidden])
Date: 2003-02-21 05:31:17

David Abrahams wrote:
> I think you may be missing the point that in some sense &k doesn't
> have to have a single type. [...]

I think this is what I'm grasping at in my example 3, but I'm just
expressing myself badly. I dragged implementation into it so that I
could show how a given TLS implementation might naively lead to one
set of properties, but that it was straightforward to engineer
different properties if we wish. I think your counter-example for
my example 2 is pretty much what I'm suggesting in example 3.

> The behavior you describe above is IMO the only reasonable one,
> but IMO we don't need the implementation details (tweaking page
> tables) in order to achieve it.

Well actually I mentioned three items...

 1 "&k" has the same value in each thread
 2 C<&k> is the same type
 3 any member of C<&K> that uses its template parameter will
     behave differently from one thread to another.

and I think Peter Dimov ran a test on the MSVC implementation
which demonstrated 2 and 3 but not 1, but perhaps I should split
item 1 into two parts...

 1a "&k" is a compile-time constant
 1b "&k", when assigned to "int*", has a different value in each

Now 1a allows it to be used as a template parameter and 1b ensures
that distinct objects have distinct addresses. (The code to convert
&k to int* is slightly non-trivial, but that's the compiler/linker's

I think all four properties are desirable, all four are achievable
with any implementation of TLS, and all four correspond to the
existing practice of MSVC.

So presumably we are all now in complete agreement, except perhaps
on the question "did my previous post actually say that". :)

Boost list run by bdawes at, gregod at, cpdaniel at, john at