var args - (nf)

ajs at hpfcla.UUCP ajs at hpfcla.UUCP
Sun Nov 6 18:37:27 AEST 1983


#R:duke:-363700:hpfcla:1500001:000:1014
hpfcla!ajs    Nov  4 15:01:00 1983

The HP9000  Series 500 also has a stack which  grows  upwards in address
space.  We attacked the variable-number-of-arguments problem this way:

1:  Push the return area first (two words).

2:  Push  the  arguments  in  reverse  order  (right  to  left),  so the
    left-most  is highest on the stack, at a known offset from the frame
    pointer.

3:  Push additional  information,  including a return area pointer and a
    number-of-arguments word.

A C program can't get to the additional  information  cleanly but it can
be done if  necessary.  Either  the  return  area  pointer  or number of
arguments may be useful.

Also, be warned that execl(2), execlp(2), and execlv(2) make assumptions
about the  order of the  arguments  (at least for  System  III).  If you
reverse that order, you have to correct the intrinsics.

(I hope this is of general  enough  interest to merit posting it instead
of responding by mail...)

Alan Silverstein, hpfcla!ajs
Hewlett-Packard Fort Collins Systems Division, Colorado



More information about the Comp.lang.c mailing list