Stack Frames

Brett Galloway brett at wjvax.UUCP
Sat Feb 22 03:57:49 AEST 1986


This posting may be slightly inappropriate in net.lang.c, but I am interested
in the matter of how variables get declared in routine subblocks (i.e.
within {} within a routine; for example:
routine()
{ int	a;
	{ int b; }
}
I would assume that they are declared in routine()'s stack frame,
and that the only effect of declaring them in a subblock is to restrict
their scope to that subblock.

HOWEVER, in the Mt Xinu port of BSD 4.2 (for a VAX 750), dbx does not seem to
treat them this way; once dbx has moved into a subblock in which variables
are declared, any variables higher up in the stack are marked as
"not active".  This behaviour of dbx appears to be wrong.  My question is
whether this behaviour is simply a shortcoming of dbx's implementation of
subblock scoping, or whether it reflects some peculiarity in the way
variables declared in subblocks are treated by the c compiler.

My apologies if this question is obvious or inappropriate.  Please send me
mail if the answer is not of general interest.

-------------
Brett Galloway
{pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett



More information about the Comp.unix.wizards mailing list