This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: thread-local storage: c99 and c++98 edits


+not be applied to block-scoped automatic or class-scoped member variables.

The C++ things you're talking about are "non-static data members".

+In C++, a thread-local variable may not be initialized at runtime,
+that is, either by a static constructor or a non-constant expression.

In C++, if an initializer is present for a thread-local variable, it must
be a constant-expression, as defined in 5.19.2 of the ANSI/ISO C++ standard.

(This is the paragraph that defines what it means to be a 
constant-expression for the purpose of non-local static object
initialization.)

+@quotation
+An object of thread storage duration shall not require a destructor.
+@end quotation

The type of an object with thread storage duration shall not have a
non-trivial destructor, nor shall it be an array type whose elements
(directly or indirectly) have non-trivial destructors.

(This is necessary to allow *any* structure type to be used in TLS.
All structure types have destructors; it's just that some of them are
trivial.)

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]