Hi,
Is there any way to avoid the compiler/linker to optimize one (and only
this) class member? Below is the code:
<code>
class MyFactory
{
/* . . . */
public static void Register( MyPrototype Proto ) { /* . . . */ }
public static MyPrototype Create( string Name ) { /* . . . */ }
}
class MyPrototype{
/* . . . */
public abstract MyPrototype Clone();
}
class MyClass : MyPrototype
{
/* . . . */
protected static MyClass sm_Instance;
protected MyClass() { MyFactory.Register( this ); }
public MyPrototype Clone() { return (MyPrototype)this; }
}
</code>
Classical Prototype project template. At least in C++. However the compiler
says that the MyClass.sm_Instance member is unused and does not take into
further consideratins. But this member has to guarranty that the prototype
registers itself in the prototype manager (factory). How to solve this
problem?
TIA
--
Roland