Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: on the fringe of C syntax/semantics
Message-ID: <1989Oct13.170321.29698@utzoo.uucp>
Organization: U of Toronto Zoology
References: <80100001@bonzo> <19971@mimsy.UUCP> <2792@lyle.UUCP>
Date: Fri, 13 Oct 89 17:03:21 GMT

In article <2792@lyle.UUCP> peterson@lyle.UUCP (James L. Peterson/1000000) writes:
>We have a number of routines which call other routines.  We want
>to interpose a general routine between each caller and called
>routine.  The parameter lists always have the same first element,
>followed by other parameters as appropriate for the called routine.
>We want the one general routine to work with the first parameter
>and then pass the entire parameter list that it got on to the
>called routine.

I'm afraid the answer is:  "you can't do this in portable C".  The C
varargs facility is *not* a general set of primitives for manipulating
argument lists; it is a special-purpose hack to legitimize a handful
of special cases like printf.  What you want to do is beyond its powers.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
