Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rochester!ritcv!ccivax!rb From: rb@ccivax.UUCP (rex ballard) Newsgroups: net.lang.c Subject: Re: Stack frames Message-ID: <420@ccivax.UUCP> Date: Thu, 20-Feb-86 13:27:24 EST Article-I.D.: ccivax.420 Posted: Thu Feb 20 13:27:24 1986 Date-Received: Mon, 24-Feb-86 04:59:46 EST References: <463@ur-helheim.UUCP> <139200021@uiucdcsb> Reply-To: rb@ccivax.UUCP (What's in a name ?) Organization: CCI Telephony Systems Group, Rochester NY Lines: 28 In article <139200021@uiucdcsb> robison@uiucdcsb.CS.UIUC.EDU writes: > >The output from C compilers I have seen indicates there is no penalty for >{} blocks with declarations. All allocation can be done at the function entry. >I.e., the source code: > > int f(x,y) > int x,y; > { > int a,b; > ... > { > int m,n; > ... > } > ... > } > >generates assembly code which allocates a,b,m, and n on the stack upon entry. >The only difference between a,b and m,n is that m,n is visible >only within the inner block. I know of two compilers, one for RT-11, that will allocate the additional stack space separately. A 'goto' in or out of an inner block will cause the stack space to be adjusted before the loop. This makes the parser simpler, but requires extra code. If no variables are declared, the block is transparent. Conditional blocks are better defined inside "allocation local blocks" in this case.