This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Reasonable static initialization assurance


Is there any reasonable manner to ensure a static object is
initialized before use without wrapping it in a getter/setter
function?

We are seeing some order issues show up on an OSX build (not linux though yet).

Take file.a and file.b:

file.a has a global variable of a table which accesses the static
System class methods for allocation and setup.

file.b has the System methods which all call an init method when first
called to make sure the system is setup right and find out what
version and computer is running.  This method accesses a static global
variable in file.b and seg faults.

Is there any way to ensure a static variable in file.b is initialized
before being used?

Corey


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]