Declaration within a loop.
Scott Amspoker
scott at bbxsda.UUCP
Thu Sep 28 05:57:42 AEST 1989
In article <14743 at bfmny0.UU.NET> tneff at 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
More information about the Comp.lang.c
mailing list