Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!bbx!bbxsda!scott From: scott@bbxsda.UUCP (Scott Amspoker) Newsgroups: comp.lang.c Subject: Re: Declaration within a loop. Message-ID: <181@bbxsda.UUCP> Date: 27 Sep 89 19:57:42 GMT References: <2085@hydra.gatech.EDU> <30174@news.Think.COM> <559@crdos1.crd.ge.COM> <14743@bfmny0.UU.NET> Reply-To: scott@bbxsda.UUCP (Scott Amspoker) Distribution: usa Organization: Basis International, Albuquerque, NM Lines: 33 In article <14743@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes: >For what it's worth AT&T's pcc on V/386 does share reuse stack space >among all temp in-block variables. Intel's C compiler does not though. >I'm sure there are tons of other examples pro and con. > This is frequently poorly implmented. I use local variables in procedures mainly to save a little stack space (although I don't do it very often). In the following example: proc() { if (...) { int i; ... } while (...) { int j; ... } } the variables 'i' and 'j' may use the same location on the stack frame. Of course, this is a trivial example. Some compilers, however, simply give all local variables their own location. I don't understand that kind of laziness. -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232