(ref.doc)jbuck 030194

Next wdr 170194 Prev: enag 020194 Up: Usenet

[email protected] (Luddy Harrison) writes:
>I've a related question: why not require that all
>static objects be initialized before control enters main()?

Consider shared libraries.  We might wish to avoid loading the library
until some part of it is actually used.  Some programs use methods like
"dlopen" (SunOS, other OSes call this something else) to permit the
program to link itself to a shared library at runtime.  It seems
appropriate in such cases to have the global constructors called at
the time the shared library is dynamically linked to, and the global
destructors can then be called when the library is "unmapped".  

Consider very large programs in which calls to global constructors might page
in lots of code.  It seems desirable to postpone the invocation of some
constructors in cases where locality of reference is improved, provided
that no user-visible difference occurs.

I believe that the ARM rule was an attempt to accomodate this.  The exact
wording of the rule seems impossible to comply with, but it would be
undesirable to "fix" this in a way that makes things worse.



-- 
-- Joe Buck	[email protected]
Posting from but not speaking for Synopsys, Inc.
Formerly jbuck@<various-hosts>.eecs.berkeley.edu


automatically generated by info2www version 1.2.2.8