Re: Gloabal object initalisation on MAC-OSX 10.3.3
Re: Gloabal object initalisation on MAC-OSX 10.3.3
- Subject: Re: Gloabal object initalisation on MAC-OSX 10.3.3
- From: Steve Checkoway <email@hidden>
- Date: Tue, 7 Feb 2006 23:07:58 -0800
On Feb 7, 2006, at 9:23 PM, Gaurav Kumar wrote:
Steve,
The problem was with translation unit.My global variable was not
initialized because of dependency factor. Actually the order of
initialization was a problem.
I have solved the problem by using Singleton object with following
code
snippet
class A{
public:
A(){
}
fun(){
}
};
A& initfun()
{
static A a;
return a;
}
In call to class A functions use this statement:
initfun().fun();
That looks good to me. You could also add a global variable
A& myA = initfun();
And then just use myA anywhere that would be accessed via a global
initializer.
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden