Topic: Order of non-local static initialization


Author: jlieb@is.morgan.com (Jerry Liebelson)
Date: Fri, 25 Feb 1994 19:58:46 GMT
Raw View
Hi,

 According to Section 3.4 of the ARM, (and I know it's only a guide
towards the eventual Standard)

 "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."

Does this apply only to the first usage that occurs AFTER the invocation
of main()?  That is, from within the constructor of a static non-local
object, invoking a function that is defined in another translation unit
will not necessarily cause the initialization of any nonlocal static objects
defined in that other translation unit?

This seems to be the case, at least with the CenterLine 2.0.4 and Lucid
3.1 compilers.

--
Jerry Liebelson
jlieb@is.morgan.com
73477.2740@compuserve.com