stack memory allocation

rcj at burl.UUCP rcj at burl.UUCP
Mon Jul 11 08:12:27 AEST 1983


The comment about it being OK to allocate from the SP is quite valid.
(At least it used to be.)  In college, we had a PDP-11/34 running
V6.  My introduction to C was in a mini-computers course where the
instructor told us one day that we had two weeks to write a crude
task scheduler to run on our PDP-11/03 (LSI-11).  The only catch
was that we had to write it completely in C, compile it into
Unix Assembler, run it through an "ed" command file to translate
it into MACRO-11, and run it without mucking with it on the LSI.

This was bad enough for us poor innocent sophomores, but what made
it even worse was that NONE of us knew C.  When this was pointed out
to the professor, he simply told us that the R&K book was $12.00 in
the bookstore.  We ended up implementing part of the code by initializing
unsigned integer arrays with hardcode instructions for the LSI, and
then calling the hardcode "routines" by doing a "goto array_name;".
In the process, we allocated space backwards from the SP and used
it with no problems.  This also allowed us to access registers
without having to use the "register" capability of C -- we weren't sure
which registers C would use and were generally paranoid about
C at the time; having had such in-depth study of it for such a
long time   :-)

Ah, the good old days,
-- 

The MAD Programmer -- 919-228-3814 (Cornet 291)
alias: Curtis Jackson	...![ floyd sb1 mhuxv ]!burl!rcj



More information about the Comp.unix.wizards mailing list