Article View: comp.std.c
Article #866Re: Passing a `va_list *'
From: Roland McGrath
Date: Sat, 28 Oct 1989 22:09
Date: Sat, 28 Oct 1989 22:09
31 lines
1326 bytes
1326 bytes
My example did indeed have typos. What I meant was:
#include <stdarg.h>
void
foo(const char *s, ...)
{
va_list args;
va_start(args, s);
bar1(va_arg(args, int));
ack(&args);
bar2(va_arg(args, float *));
va_end(args);
}
void ack(va_list *args)
{
blip(va_arg(*args, int **));
}
I have a somewhat old draft of the Standard (May 1988), but I can't find
anything that actually says this isn't allowed.
I don't see the problem with whatever type `va_list' is. You can take the
address of an object of any type (though not every storage class), and
dereference the pointer thus obtained.
--
Roland McGrath
Free Software Foundation, Inc.
roland@ai.mit.edu, uunet!ai.mit.edu!roland
Technical Details
Message-ID:
<MCGRATH.89Oct28150927@paris.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!paris.Berkeley.EDU!mcgrathReferences:
<MCGRATH.89Oct27150426@tully.Berkeley.EDU> <11439@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!paris.Berkeley.EDU!mcgrath From: mcgrath@paris.Berkeley.EDU (Roland McGrath) Newsgroups: comp.std.c Subject: Re: Passing a `va_list *' Message-ID: <MCGRATH.89Oct28150927@paris.Berkeley.EDU> Date: 28 Oct 89 22:09:27 GMT References: <MCGRATH.89Oct27150426@tully.Berkeley.EDU> <11439@smoke.BRL.MIL> Sender: news@pasteur.Berkeley.EDU Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 31 In-reply-to: gwyn@smoke.BRL.MIL's message of 28 Oct 89 05:56:13 GMT