Hi,
in this code:
int foo() {
static int x;
}
is the x
global to all threads or local in each thread? Or does that depends on a compiler flag and/or the compiler, so I cannot really know what it is from the code?
Several questions (all of them independent from compiler and compiler flags and OS):
- How can I create a static variable which is global to all threads?
- How can I create a static variable which is local to each thread?
- How can I create a global variable which is global to all threads?
- How can I create a global variable which is local to each thread?
I guess that this is not in C++ itself. (Is it in C++0x?) Some Boost lib which can do this?