Xref: utzoo comp.lang.c:29991 comp.lang.c++:8272 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!inria!mirsa!picsou.inria.fr!lagache From: lagache@picsou.inria.fr (Edouard Lagache) Newsgroups: comp.lang.c,comp.lang.c++ Subject: ?- The number of variable arguments to a function?? Keywords: "C", , Common LISP's &rest Message-ID: <8262@mirsa.inria.fr> Date: 29 Jun 90 10:49:47 GMT Sender: news@mirsa.inria.fr Reply-To: lagache@picsou.inria.fr (Edouard Lagache) Organization: INRIA Sophia-Antipolis, labo SIDE Lines: 25 Hello World! I have a tiny problem here which I'd appreciate a little help with. I'd like to write a "C" function (actually C++, but same difference), that takes a variable number of arguments (some sort of data structure), and returns a continuous block of memory containing those arguments in that order. Looking at K&R, I see how I can get hold of the arguments, but not how to find the number of arguments. Because in my case all the arguments are of the same type (size), I could malloc (or New) the right block size if I knew how many arguments were in the list. Any thoughts? It occurred to me that I could just run through the argument list twice, but I don't know if that can be done in an implementation independant way. Thanks in advance for the help! Edouard Lagache INRIA, Sophia Antipolis - FRANCE (for the summer) P.S. Please reply to me directly, I'll post a summary if there is interest.