Article View: comp.std.c++
Article #2139Global object initialization again
From: Eugene Radchenko
Date: Fri, 06 Oct 1995 18:54
Date: Fri, 06 Oct 1995 18:54
34 lines
2288 bytes
2288 bytes
Hello people!
I would like to learn more about the proposal by German ISO representative
allowing (partial) programmer control of the inter-file initialization
order. This would be a very useful feature, especially in designs where you
need some server object in one module to be initialized before other
modules can access it.
Schwartz counters help here, but there are the situations where they are
insufficient. E.g. server initialization in module A calls the function
which dynamically selects the type of server object, creates it (using
new) and returns the pointer. For some types, it needs to access another
server from module B. But there is no way (short of #including B-module
header in A-module header where it is otherwise unnecessary) to ensure that
B-server gets initialized prior to A-server.
Techniques relying on static zero-initialization and/or local static
objects initialized upon function entry also do not solve the problem, as
servers requiring non-trivial init often need non-trivial shutdown as well
- in exactly the same environment. While my compiler (BC++ 4.0) at least
does strange things to order of local static objects cleanup.
Best regards Genie
--
--------------------------------------------------------------------
Eugene V. Radchenko Graduate Student in Computer Chemistry
E-mail: eugene@qsar.chem.msu.su Fax: +7-(095)939-0290
Ordinary mail: Chair of Organic Chemistry, Department of Chemistry,
Moscow State University, 119899 Moscow, Russia
***************** Disappearances are deceptive *******************
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<AFQDKTmKgB@qsar.chem.msu.su>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 06 Oct 95 18:54:07 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Message-ID: <AFQDKTmKgB@qsar.chem.msu.su> Organization: Lab. of Org.Synth., MSU X-Original-Date: Fri, 6 Oct 1995 17:55:22 +0300 (MSK) From: "Eugene Radchenko" <eugene@qsar.chem.msu.su> X-Mailer: dMail [Demos Mail for DOS v1.23] Subject: Global object initialization again