From -3893384593007836865
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,bda3b729e5d0c564
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-04-06 13:13:18 PST
Newsgroups: comp.std.c++
Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!sdd.hp.com!network.ucsd.edu!munnari.oz.au!metro!news
From: maxtal@physics.su.OZ.AU (John Max Skaller)
Subject: Re: Guaranteed order of destruction for auto objects?
Message-ID: <1993Apr6.185713.18835@ucc.su.OZ.AU>
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: physics.su.oz.au
Organization: School of Physics, University of Sydney, Australia
References: <25207@alice.att.com> <KANZE.93Apr5161212@slsvdnt.us-es.sel.de> <25220@alice.att.com>
Date: Tue, 6 Apr 1993 18:57:13 GMT
Lines: 47

> > 	FooBar()
> > 	{
> > 		goto A ;
> > 	B :
> > 		Foo		a ;
> > 		goto C ;
> > 	A :
> > 		Bar		b ;
> > 		goto B ;
> > 	C :
> > 		// ...
> > 	}
> > 
> > (Note that b gets constructed before a.)
> > 
> > Or is this forbidden by the rule about jumping over an initializer?
>
>It is indeed not allowed to jump past an initializer (except of course if
>the initializer is in an inner scope that is completely bypassed by the
>jump).
>

	Is there a rule about CALLING past an initialiser?

	This came up when I was considering nested functions.
	If there are forward declarations, it is possible
	for a nested function to reference an uninitialised variable.

	Well, while trying to work out sensible rules that
	would prevent this, it occured to me the problem
	ALREADY exists anyhow for non-nested functions:

	extern T g();

	T x=g(); // does a 'goto' that skips past an initialisation
	T y=k();
	T g() { return y;}

The second question is whether this rule (or no rule :-) is
acceptable for nested functions.

	
--
        JOHN (MAX) SKALLER,         INTERNET:maxtal@suphys.physics.su.oz.au
	Maxtal Pty Ltd,		    CSERVE:10236.1703 
        6 MacKay St ASHFIELD,	    Mem: SA IT/9/22,SC22/WG21 
        NSW 2131, AUSTRALIA	    


