Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!philabs!seismo!hao!hplabs!sri-unix!eric@cit-vax
From: eric%cit-vax@sri-unix.UUCP
Newsgroups: net.unix-wizards
Subject: stack memory allocation
Message-ID: <2691@sri-arpa.UUCP>
Date: Thu, 30-Jun-83 20:47:56 EDT
Article-I.D.: sri-arpa.2691
Posted: Thu Jun 30 20:47:56 1983
Date-Received: Thu, 7-Jul-83 03:23:58 EDT
Lines: 20

[4.1bsd VAX 11/780]

I want to allocate dynamic arrays in such a way that they go away
automatically when the procedure exits. Normally, I'd just use malloc
and free the memory at the end of the procedure. However, this procedure
can be interrupted (by ^C) causing a non-local goto (via setjmp/longjmp).

The easiest way to do this is to write a routine "salloc" which allocates
the space on the stack by decrementing SP and returning its new value.
(Languages like ALGOL do this for you, array bounds can be variables).

What I need to know is whether the C compiler mucks around with the
stack pointer at times other than procedure linkage and local variable
space allocation, i.e. at times other than procedure entry/exit. Does it,
for example, change the stack pointer to allocate register spill space
during complex expression evaauation? Does anyone know? Thanks.

				    - Eric Holstege
				    (eric@cit-vax)
				    (...ucbvax!cithep!citcsv!eric)