Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 07:44:02


Gabriel Dos Reis <gdr_at_[hidden]> writes:

> | OK, whatever. I guess I should've said that you can instantiate a
> | template on &k with sensible results. Whether or not you want to call
> | it a constant is another semantic matter. I'd call it a constant
> | which evaluates differently in different threads.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> And that isn't just a word-game as your message might imply it.

I never meant to imply that it's a word game, just that I'm only
willing to concede "not a constant-ness" for some very narrow
definition of the word "constant." If you think of threads as being
truly concurrent, the value actually _is_ constant (just different in
different threads).

> | Within a single thread the value never changes.
>
> Like in
>
> template<typename T>
> struct X { };
>
> int main()
> {
> const int i = 2003;
> X<&i> x;
> }
>
> ?

Not sure what you're getting at, since the code is invalid. I'll
assume you meant X to take an int* parameter.

> In a given program run, &i won't change. That is just in single
> thread mode. Let's solve that first.

What is there to solve? I'm not interested in making the above legal
(is calling main explicitly really disallowed?), but even if I were,
it doesn't seem closely related to the TLS problem. I don't see how
solving your case would help (not that I understand what solving it
might mean).

> Extrapolating to a multi-thread mode isn't just changing a word.

BTW, aren't we wildly OT discussing this here? Shouldn't it go to a
committee reflector or comp.std.c++?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk