Stack frames

Doug Gwyn gwyn at brl-smoke.ARPA
Sun Feb 16 17:30:32 AEST 1986


In article <463 at ur-helheim.UUCP> dave at ur-helheim.UUCP (Raver Dave) writes:
>
>In c one can declare variables within any {} block.  Does a
>{} pair *imply* new context, with stack frame shifts, etc.
>I would have to assume so if local variables are declared
>within the {} but if no variables are declared? ...
>
>The reason for asking is for ease of expansion and 
>consistancy of formatting I often put {} blocks where
>they are not necessary (clauses that are only one
>statement).  Am I paying a penalty for these one-statement
>clauses or will my trusted compiler note the context has
>not changed and inhibit the subsequent costly stack manipulations?

If your C compiler generates additional overhead for local
blocks, it is not very good.  Most reasonable implementations
reserve enough stack at function entry for the deepest local
block nesting within the function, so that there is no
run-time action required upon entering a local block.



More information about the Comp.lang.c mailing list