Stack frames

robison at uiucdcsb.CS.UIUC.EDU robison at uiucdcsb.CS.UIUC.EDU
Tue Feb 18 02:44:00 AEST 1986


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.

- Arch Robison



More information about the Comp.lang.c mailing list