on the fringe of C syntax/semantics

Henry Spencer henry at utzoo.uucp
Sat Oct 14 03:03:21 AEST 1989


In article <2792 at lyle.UUCP> peterson at 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 at zoo.toronto.edu



More information about the Comp.lang.c mailing list