dynamic library and initialisation
Eljay Love-Jensen
eljay@adobe.com
Tue Sep 7 13:02:00 GMT 2004
Hi Sebastien,
Use an class method accessor to guarantee initialization.
class NoGood
{
public:
static Thingy thing;
};
// Hey, not always initialized!
Thingy NoGood::thing("alpha", "beta");
- - - - -
class ThisWorks
{
public:
static Thingy& GetThingy();
};
Thingy& ThisWorks::GetThingy()
{
static Thingy thing("alpha", "beta");
return thing;
}
HTH,
--Eljay
More information about the Gcc-help
mailing list