🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2108

Re: Static objects initialization before main()

#2108
From: Michael Furman
Date: Wed, 04 Oct 1995 16:07
28 lines
1909 bytes
In article <44rrsp$r59@peippo.cs.tut.fi>, esap@cs.tut.fi says...
>
>I once thought marking an object volatile would do the trick.
>Since as the DWP states ([dcl.type.cv]/7) volatile is meant to disallow
>a set of optimizations for the use of the object. When an object is
>volatile, the compiler shouldn't make any assumptions about when
>the object's value is changed. Thus, since the compiler 
>can't know when the object's value is changed, it can't rely it
>being initialized when the first use of the object is made 
>[basic.start.init]/1  (perhaps in an interrupt etc), except if it 
>initializes the object before main(). Of course this applies only to
>volatile objects with static storage duration and user defined
>constructor.

I certainly like that. Is it possible to consider this as a proposal for 
changing C++ standard?

	Michael

Michael Furman,                                   (603)893-1109
Geophysical Survey Systems, Inc.              fax:(603)889-3984
13 Klein Drive - P.O. Box 97                      engr@gssi.mv.com 
North Salem, NH 03073-0097                        71543.1334@compuserve.com
-----------------------------------------------------------------------------
---
[ 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: <DFxEvM.L8w@mv.mv.com>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <199510021604.MAA10538@mv.mv.com> <44rrsp$r59@peippo.cs.tut.fi>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 04 Oct 95 16:07:10 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
From: ENGR@GSSI.MV.COM (Michael Furman)
Subject: Re: Static objects initialization before main()
Message-ID: <DFxEvM.L8w@mv.mv.com>
Sender: usenet@mv.MV.COM (Paul Hurley)
Organization: GSSI
X-Original-Date: Wed, 4 Oct 1995 13:30:58 GMT
References: <199510021604.MAA10538@mv.mv.com> <44rrsp$r59@peippo.cs.tut.fi>
X-Newsreader: WinVN 0.93.10