Xref: utzoo comp.lang.c++:14370 comp.sys.apollo:9561 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!radar!cadillac!dsouza From: dsouza@gwen.cad.mcc.com (Desmond Dsouza) Newsgroups: comp.lang.c++,comp.sys.apollo Subject: Static Initializers: [Was: Re: Is this a bug in Apollo C++ Compiler System?] Message-ID: Date: 25 Jun 91 16:57:11 GMT References: <1801@usage.csd.unsw.oz.au> Sender: news@cadillac.CAD.MCC.COM Followup-To: comp.sys.apollo Organization: MCC CAD Program, Austin, Texas Lines: 29 In-reply-to: ashley@usage.csd.oz's message of 25 Jun 91 03:19:36 GMT In article <1801@usage.csd.unsw.oz.au> ashley@usage.csd.oz (Ashley Aitken) writes: Not all constructors and destructors for global (and static) objects (in separated source files) are called before the start of the main program. Those called depend on the order of linking of the object files. Global objects do NOT have to be constructed before main() is entered. The language simply requires that such globals be constructed "... before the first use of any function or object defined in THAT translation unit". An implementation is free to defer initialization until that time (see ARM, Sec. 3.4). Can someone clarify the ARM definition for me, please. Is it the case that I can freely refer to global objects defined in any other files and be assured that they are initialized before they are first accessed? -- Desmond. -- ------------------------------------------------------------------------------- Desmond D'Souza, MCC CAD Program | ARPA: dsouza@mcc.com | Phone: [512] 338-3324 Box 200195, Austin, TX 78720 | UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!dsouza