Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: gnu.gcc Subject: Re: A question on local variable allocation Message-ID: <50194@lll-winken.LLNL.GOV> Date: 27 Feb 90 07:57:18 GMT References: <25E58087.11649@paris.ics.uci.edu> <6915@internal.Apple.COM> Sender: usenet@lll-winken.LLNL.GOV Reply-To: casey@gauss.llnl.gov (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 25 | From: escher@Apple.COM (Michael Crawford) | | >From: rfg@paris.ics.uci.edu (Ronald Guilmette) | > | >Can someone please explain to me why [GCC doesn't map local variables in | >non-nested blocks into the same stack space?] | | I believe the reason is that C allows one to goto the inside of a block | from the outside, as long as the goto is within the same function. This | would allow one to jump back and forth between the two blocks given. Who cares? Jumping out of and into blocks is the same as exiting and entering the block contexts. Unless the ANSI C standard says that local block variable values should be preserved over the execution lifetime of a function call you shouldn't expect them to contain any particular value on entry into the block (via whatever means.) Barring such language in the standard, the compiler should simply allocate the hierarchal union of all local variable storage used in the function on entry to the function. Would someone look this up in the ANSI C standard and see what it says ablout the values of local block variables over the execution lifetime of a function? Who knows, they may have put specific language in saying that goto's do preserve value! Yech!!! Casey