Re: thread local variable
Wow. Too many years of C++ and file scope variable use has been covered
with cobwebs in the back of my brain :)
I forgot this gem about "static":
"When modifying a variable or function at file scope, the static keyword
specifies that the variable or function has internal linkage (its name is
not visible from outside the file in which it is declared)."
With that, I wondered if a file scope __declspec(thread) variable had to
have the static keyword.
I tested it and it doesn't. It can be extern. :)
Thanks for the brain exercise!
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
news:npjbc3l81qejadbi34h1djuer357pr9bbr@4ax.com...
On Fri, 17 Aug 2007 08:53:50 -0700, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
:) The "Nitpicking police"
Isn't that variable implicitly static?
Namespace-scope objects implicitly have "static storage duration", but I
guess the nitpicker objection is that "static object" means using the
"static" keyword, even though from context, what was meant is clear (at
least if you know what it's *trying* to say <g>). The problem is that
static also has a linkage aspect, though IIRC, that part of it is
deprecated due to the availability of anonymous namespaces, which are more
powerful.
I think the point is it can't be an
automatic variable.
That is indeed the point.
--
Doug Harrison
Visual C++ MVP