var args - (nf)
ggr at pyuxbb.UUCP
ggr at pyuxbb.UUCP
Fri Nov 4 08:37:34 AEST 1983
> Re: S-1 upward growing stack.
>
> (Of course, this depends on your hardware cooperating.) The way I would
> solve the problem would be to have the frame pointer point to the first
> argument (or, perhaps, to the word above the first argument), so that args
> would be at (constant) negative offsets form the frame pointer, and local
> vars would be at positive offsets. Then you don't have a problem with
> getting the wrong arg when called with the wrong number of them.
>
> =Spencer
Yes, I can testify that this scheme works fine. I used negative offsets
for arguments in the Data General Nova/Eclipse C compiler I wrote,
since their hardware stacks also grew upward.
With appropriate modification of /usr/include/varargs.h, functions that
expect a variable number of arguments (and use varargs, of course)
will even work with this "unconventional" stack structure.
=== Guy Riddle == AT&T Bell Laboratories, Piscataway ===
More information about the Comp.lang.c
mailing list