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\'
How about using the keyword volatile? It will prevent the compiler from too much optimization.