🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #34

Re: stdarg facility, va_start more than once?

#34
From: Larry Jones
Date: Thu, 29 Oct 1992 19:06
28 lines
1832 bytes
In article <1992Oct29.082319.7188@saaf.se>, pausch@saaf.se (Paul Schlyter) writes:
> Which brings up the next question: is it legal to invoke va_start more
> than once in the same function, without an invocation of va_end in
> between?
> 
> There are many implementations where this is ok (and where, by the way,
> va_end expands to an empty macro) -- but is it generally legal?

Sure, if you use a different va_list in each call. :-)

I remember extensive discussions of all sorts of "interesting" existing
<varargs.h> implementations as well as some reasonable hypothetical
ones.  My recollection is that the committee intended to allow all of
these techniques as valid implementations of <stdarg.h>, which would
imply that va_start and va_end must be paired and must appear in the
same scope.  If you want your code to be maximally portable, then that
is the approach I would take.

The standard does not seem to require such caution, however.  The
description of va_start does not require a matching va_end, let alone
one in the same scope.  The only requirement appears to be that, if
va_start is called within a function, va_end be called before that
function returns.  This is probably worthy of a formal request for
interpretation.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
I don't see why some people even HAVE cars. -- Calvin
Technical Details
Message-ID: <2189@sdrc.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjones
References: <MGK.92Oct27155222@cedar.sql.sybase.com> <2176@sdrc.COM> <1992Oct29.082319.7188@saaf.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjones
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.std.c
Subject: Re: stdarg facility, va_start more than once?
Message-ID: <2189@sdrc.COM>
Date: 29 Oct 92 19:06:52 GMT
References: <MGK.92Oct27155222@cedar.sql.sybase.com> <2176@sdrc.COM> <1992Oct29.082319.7188@saaf.se>
Sender: news@sdrc.COM
Distribution: comp
Lines: 28