David Abrahams wrote:
> 
> Gabriel Dos Reis <[EMAIL PROTECTED]> writes:
> 
> > David Abrahams <[EMAIL PROTECTED]> writes:
> >
> > | I disagree with your conclusion.  As I've said elsewhere, &k can be a
> > | compile-time constant in the same way that &X::k is a compile-time
> > | constant.
> >
> > Certainly, you've said that.  But that assertion by itself does not
> > constitute a proof of the well-foundness of the attempted analogy or
> > whether the analogy actually constitutes a proof.
> 
> It's not intended to be proof in the mathematical sense; I doubt I
> have the energy for that ;-), though I think MSVC probably constitutes
> an existence proof.

Yeah. Indeed: <http://tinyurl.com/673e>

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_rules_and_limitations_for_tls.asp

"....
 The address of a thread local object is not considered constant, 
 and any expression involving such an address is not considered 
 a constant expression. In standard C, the effect of this is to 
 forbid the use of the address of a thread local variable as an 
 initializer for an object or pointer. For example, the 
 following code will be flagged as an error by the C compiler: 

   #define Thread  __declspec( thread )
   Thread int tls_i;
   int *p = &tls_i;       //This will generate an error in C.

 This restriction does not apply in C++, however. Because C++ 
 permits dynamic initialization of all objects, you can 
 initialize an object with an expression that uses the address 
 of a thread local variable. This is accomplished in the same 
 way as the construction of thread local objects. For example, 
 the code shown above will not generate an error when compiled 
 as a C++ source file. Note that the address of a thread local 
 variable is valid only as long as the thread in which the 
 address was taken still exists. 
 ...."

regards,
alexander.

P.S. Kinda-funny stuff: "C++ does not allow such dynamic 
initialization of thread data because of possible future 
enhancements to the thread local storage facility."

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to