Article View: comp.std.c
Article #5002va_list, function calls.
From: Peter Seebach
Date: Tue, 09 Apr 1996 12:11
Date: Tue, 09 Apr 1996 12:11
38 lines
1355 bytes
1355 bytes
I am unclear on the language in the standard describing this.
Consider:
void foo(int bar, ...) {
va_list ap;
int i;
va_start(ap, bar);
for (i = 0; i < bar; ++i)
baz(&ap);
va_end(ap);
}
void baz(va_list *ap) {
printf("%d\n", va_arg(*ap));
}
Assuming that foo is called like
foo(1, 1);
foo(2, 18, 23);
...
is this legal?
If not, is there a compelling reason?
I have a proposal in the works for printf() enhancements, but the
obvious implementation would basically require that it be possible
for a function with a va_list to safely have a child function access
and modify that va_list. The standard's wording appears to me to
apply only to passing the list itself, not its address.
-s
--
Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
FUCK the communications decency act. Goddamned government. [literally.]
The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
Technical Details
Message-ID:
<4kdk5v$mn@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: seebs@solutions.solon.com (Peter Seebach) Newsgroups: comp.std.c Subject: va_list, function calls. Date: 9 Apr 1996 07:11:43 -0500 Organization: Usenet Fact Police (Undercover) Message-ID: <4kdk5v$mn@solutions.solon.com> Reply-To: seebs@solon.com NNTP-Posting-Host: solutions.solon.com