Is it ok to use a static variable to initialize/register variables?
问题 Language: C++ Toolkit: Qt4 The toolkit I'm using has a static method called int QEvent::registerEventType() to register my own event types. When I subclass this QEvent I need to supply the base class this value. QEvent::QEvent(int type) . Is it ok to use a static variable to call this before application starts? Consider the following: //This is all in my .cpp file static int myEventType; //This will contain my registered type /*If I create a static instance of this class the constructor gets