Article View: comp.std.c
Article #2083Re: A different question about va_start & va_end.
From: Norman Diamond
Date: Fri, 06 Nov 1992 11:25
Date: Fri, 06 Nov 1992 11:25
32 lines
2005 bytes
2005 bytes
In article <1992Nov6.014500.1353@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:
>Must a standard conforming implementation accept:
s/standard conforming implementation/conforming implementation/
> #include <stdarg.h>
> int i, j;
> va_list ap;
> void foo (int bar, ...) {
> i = (va_start (ap, bar), 99);
> j = (va_end (ap), 88);
> }
>In other words, may a programmer safely assume that invocations (or
>expansions) of va_start and va_end are themselves expressions?
>The function declarations shown in 4.8.1.1 and 4.8.1.2 seem to suggest
>that the answer is yes.
4.8.1, page 123 lines 17 to 19, says that va_start and va_arg must
be macros, while va_end may be either macro or identifier. However,
if we interpret the function declarations as specifying usage syntax,
then I would say that they must be expressions, as you say.
The va_list ap; declaration must be moved inside the function.
4.8, page 123 lines 11 to 12. Ah wait a minute. The function has to
have this declaration, not necessarily a definition. So you can keep
the file scope one (with external linkage at that) and just copy it
into the function as well. I wonder if this is a bug (different rule
from what was intended) in the standard.
--
Norman Diamond diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"It's been a lovely recession."
Technical Details
Message-ID:
<BxAL1r.J3r@jrd.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!decuac!pa.dec.com!jrdzzz.jrd.dec.com!jit345.bad.jit.dec.com!diamondReferences:
<1992Nov6.014500.1353@netcom.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!haven.umd.edu!decuac!pa.dec.com!jrdzzz.jrd.dec.com!jit345.bad.jit.dec.com!diamond From: diamond@jit345.bad.jit.dec.com (Norman Diamond) Subject: Re: A different question about va_start & va_end. Message-ID: <BxAL1r.J3r@jrd.dec.com> Sender: usenet@jrd.dec.com (USENET News System) Nntp-Posting-Host: jit345 Reply-To: diamond@jit.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo References: <1992Nov6.014500.1353@netcom.com> Date: Fri, 6 Nov 1992 11:25:03 GMT Lines: 32