Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Passing a `va_list *' Message-ID: <11439@smoke.BRL.MIL> Date: 28 Oct 89 05:56:13 GMT References: Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 27 In article mcgrath@tully.Berkeley.EDU (Roland McGrath) writes: >#include That should be , of course. > va_list args; > ack(&args); ... >void ack(va_list *args) >{ > blip(va_arg(args, int **)); >} I wonder how this could possibly have worked. va_arg() takes a va_list as its first argument, not a va_list*. Let's assume this is a typo. I don't have my copy of the Standard at hand at the moment, but I did spend a lot of time working in this area, and as I recall the Standard guarantees that you can pass the va_list to a function and continue to use it within the function, but not necessarily a pointer to the va_list. Upon return from the function, the va_list is "dead" until va_end()ed and re-va_start()ed. To answer the question of whether you can use a pointer to the va_list, you need to consider what types are allowed for va_list. I don't recall exactly how this ended up; it changed around a few times. The one to watch out for is an array type.