Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!bloom-beacon!adam.pika.mit.edu!scs From: scs@adam.pika.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: passing variable numbers of arguments Keywords: varargs callg Message-ID: <8711@bloom-beacon.MIT.EDU> Date: 10 Jan 89 04:09:06 GMT References: <899@thor.stolaf.edu> <8699@alice.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu (Steve Summit) Distribution: na Lines: 21 In article <8699@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes: >There is no way to pass your entire argument list to another function. Well, no socially acceptable way, maybe, but in the words of Romeo Void, "Never say 'Never'." I've got a routine called "callg," named after the VAX instruction of the same name, which lets you call an arbitrary function with an arbitrary number of arguments. It's sort of an inverse varargs. Among other things, I have used it to solve exactly the problem being discussed here, namely to call a varargs function from a varargs function, explicitly passing all of the first varargs function's arguments, rather than indirectly through a va_list. callg is actually implemented such that its invocation is (well, could be, I haven't tried it everywhere) portable, although the underlying implementation is obviously highly machine dependent. (It's one of a handful of functions I know of that can't possibly be written in C.) Steve Summit scs@adam.pika.mit.edu