I\'m using static initialisation to ease the process of registering some classes with a factory in C++. Unfortunately, I think the compiler is optimising out the \'unused\'
you could use
#pragma optimize off int globalVar #pragma optimize on
but I dunno if that only works in Visual Studio ( http://msdn.microsoft.com/en-us/library/chh3fb0k(VS.80).aspx ).
You could also tell the compiler to not optimize at all, especially if you're debugging...