[net.lang.c] Contiguous function arguments

kim@mcrware.UUCP (Kim Kempf) (02/20/85)

Where is it written that function arguments must appear on the
stack contiguously?  K & R says the arguments are "passed by value", giving
no indication that the arguments should be on the stack or in a register.

Any comments?

henry@utzoo.UUCP (Henry Spencer) (02/22/85)

> Where is it written that function arguments must appear on the
> stack contiguously?  K & R says the arguments are "passed by value", giving
> no indication that the arguments should be on the stack or in a register.

Nowhere is it written that function arguments must appear on the stack
contiguously, although there are a number of brain-damaged programs
that assume they do.  The main problem that must be coped with, if
another scheme is used, is the implementation of printf() and its kin.
It is useful, although not absolutely vital, if you can devise a way
of implementing the <varargs.h> primitives also.  This is harder, since
printf() and such can always be kludged in some messy way, but <varargs.h>
forces you to provide a clean interface to the mess.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

roy@phri.UUCP (Roy Smith) (02/23/85)

> Where is it written that function arguments must appear on the
> stack contiguously?  K & R says the arguments are "passed by value", giving
> no indication that the arguments should be on the stack or in a register.

It seems to me that if you are on a machine with a register file architecture
(like RISC), you would expect the arguments to NOT be on the stack!  I wouldn't
count on anything about formal parameter memory allocation.
-- 

The opinions expressed herein do not necessarily reflect
the views of the Public Health Research Institute.

{decvax,ihnp4}!vax135!timeinc\
                              >!phri!roy (Roy Smith)
     {allegra,rocky2}!cubsvax/