Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!world!wmm From: wmm@world.std.com (William M Miller) Newsgroups: comp.lang.c++ Subject: Re: Initializing Global Objects Message-ID: <1991May27.185059.8656@world.std.com> Date: 27 May 91 18:50:59 GMT References: <76813@brunix.UUCP> <1991May27.060310.16757@mathcs.sjsu.edu> <750@taumet.com> Organization: Glockenspiel, Ltd. Lines: 22 steve@taumet.com (Stephen Clamage) writes: > Cay's analysis reflects current implementations, but not anything in the > language definition. The language definition makes no distinction between > the initialization of > int i = 1; // value can be part of load image > and > extern int j, k; > class C { C(int, int); ... }; > C c(j, k); // value cannot be part of load image > > The requirement is merely that both initializations be complete before > the first statement of main() is executed. Actually, it's not even defined that closely; section 3.4 of E&S says, "The initialization of nonlocal static objects in a translation unit is done before the first use of any function or object defined in that translation unit. Such initializations may be done before the first statement of main() or deferred to any point in time before the first use of a function or object defined in that translation unit." -- William M. Miller, Glockenspiel, Ltd. wmm@world.std.com