Its platform is specific. Windows, for example, you should use __declspec( thread ) . The compiler will use the TLS API (TlsAlloc, TlsFree and friends), and on Win32 you should always use FLS (Fiber Local Storage) instead of TLS, but the TLS API silently redirects you to FLS in any modern version of Win32.
source share