Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: Stack frames Message-ID: <985@brl-smoke.ARPA> Date: Sun, 16-Feb-86 02:30:32 EST Article-I.D.: brl-smok.985 Posted: Sun Feb 16 02:30:32 1986 Date-Received: Tue, 18-Feb-86 04:23:27 EST References: <463@ur-helheim.UUCP> Reply-To: gwyn@brl.ARPA Organization: /usr/local/lib/news/organization Lines: 19 In article <463@ur-helheim.UUCP> dave@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.