__thread storage specifier documentation

Roger Ferrer Ibáñez roger.ferrer@bsc.es
Thu Dec 21 12:57:00 GMT 2006


Hi,

this is just a minor clarification about the documentation on __thread 
gcc keyword.

According to

http://gcc.gnu.org/onlinedocs/gcc/Thread_002dLocal.html#Thread_002dLocal

"The __thread specifier may be used alone, with the extern or static 
specifiers, but with no other storage class specifier. When used with 
extern or static, __thread must appear _immediately_ after the other 
storage class specifier."

I wonder if this _immediately_ means that the __thread keyword must 
appear next to the "extern" or "static" (if any) or the programmer can 
intersperse other declaration specifiers between them, but keeping the 
order between storage specifiers.

I mean,

void f()
{
/* This is strictly immediately "static __thread", gcc accepts this */
   static __thread int a;

/* This is not strictly immediately, there is type-specifier 'int' 
between 'static' and '__thread' and gcc accepts this */
   static int __thread b;
}

Thank you !

-- 
Roger Ferrer Ibáñez - roger.ferrer@bsc.es



More information about the Gcc-help mailing list