You mean things like "volatile"? That doesn't make anything "safer" - it makes the compiler not optimize the read/write operations to the data item (and in later versions of MS compilers "lock" the data access for read-modify-write operations). It does not fix this:
Call this function from two different functions with different values - then print the string - guess what: both threads will possibly print the same thing, and sometimes print "the wrong strings" value.Code:char *somefunc(int x) { static char buffer[100]; sprintf(buffer, "%d", x); return buffer; }
Volatile, or just about any other "compiler" solution will not solve this.
--
Mats