[comp.lang.c] Son of: Building function call at runtime

stumpf@gtenmc.UUCP (Jon S. Stumpf) (12/12/89)

In article <622@chem.ucsd.EDU> you write:
>In article <307@gtenmc.UUCP> stumpf@gtenmc.UUCP (Jon S. Stumpf) writes:
>>	How do I get the variables off the application stack and
>>	onto the runtime stack so error() can use <varargs.h> ?
>
>Use vfprintf(), which takes a varargs list as an argument:

Thnak you for your prompt reply.  However, I know of vfprintf() and I
know how to use it.  I mentioned these in my request.

Here is another way to express my problem.

	I have a linked list of data;
	I want each element to be an argument to the error routine;
	I want to call the error routine only one time for the entire list;


I am posting this in case I didn't express
the problem clearly (very possible).

-- 
 jss - Jon S. Stumpf

henry@utzoo.uucp (Henry Spencer) (12/13/89)

In article <310@gtenmc.UUCP> stumpf@gtenmc.UUCP (Jon S. Stumpf) writes:
>Here is another way to express my problem.
>	I have a linked list of data;
>	I want each element to be an argument to the error routine;
>	I want to call the error routine only one time for the entire list;
>I am posting this in case I didn't express the problem clearly (very possible).

Expressed this way, the answer is very simple:  you can't do this in C in
any portable way.  (There is no guarantee that you can do it even in an
unportable way.)  C simply does not give you the ability to build argument
lists yourself.  There are a few kludges for awkward cases like printf,
but no general primitives.
-- 
1755 EST, Dec 14, 1972:  human |     Henry Spencer at U of Toronto Zoology
exploration of space terminates| uunet!attcan!utzoo!henry henry@zoo.toronto.edu