c++ static object not created
Wed Nov 19 15:31:00 GMT 2008
> static SomeClass my_instance;
> I found that if there is no reference to this instance, then gcc does not
> call its constructor at all.
> How can it be forced?
I found that if there is another similar object in this file which is
referenced externally, then the constructor of my_instance is also called,
even if it is marked static, and has no references.
I have gcc 4.3.1 on SuSE 11.0
Linux notebook 18.104.22.168-0.2-pae #1 SMP 2008-10-21 16:30:26 +0200 i686 i686
More information about the Gcc-help