Article View: comp.std.c++
Article #2039Questions concerning initialization of nonlocals
From: Wesley E. Munsil
Date: Mon, 25 Sep 1995 21:19
Date: Mon, 25 Sep 1995 21:19
31 lines
1780 bytes
1780 bytes
Please consider the following program schema and questions.
// Declare class A with non-trivial constructor
#include "a.h"
static A a;
int main()
{
// Nontrivial use of a
return 0;
}
(1) Will the standard require that a's constructor be called?
(2) If the answer to (1) is "yes", will the standard impose any constraints
as to the time at or by which the call must occur?
(3) If the answer to (1) is "yes" and the answer to (2) is "no", does not
this imply that a compiler is free to time the call to occur whenever
it likes, say, immediately prior to termination of the program?
(4) If the answer to (1) is "yes" and the answer to (2) is "yes", what are
those constraints? Please answer in the most general form.
Thank you.
[ 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:
<DFHC1v.Kq5@peacock.tcinc.com>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: "Wesley E. Munsil" <wmunsil@tcinc.com> Newsgroups: comp.std.c++ Subject: Questions concerning initialization of nonlocals Date: 25 Sep 1995 21:19:49 GMT Organization: Tele-Communications, Inc. Sender: news@tcinc.com (TCI External Internet News Administration) Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <DFHC1v.Kq5@peacock.tcinc.com> NNTP-Posting-Host: taumet.eng.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; conversions="7bit" Content-Transfer-Encoding: 7bit X-Nntp-Posting-Host: aitsun17 X-Mailer: Mozilla 1.1 (X11; U; SunOS 5.4 sun4m) X-Url: news:comp.std.c++ Apparently-To: comp-std-c++@uunet.uu.net X-Lines: 27 Content-Length: 757 Originator: clamage@taumet