From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] stdarg & va_copy
Date: Thu, 24 Jan 2008 17:45:17 -0500 [thread overview]
Message-ID: <8280E7F9-6119-4570-823D-C920E0EBD50D@mac.com> (raw)
In-Reply-To: <20080124223857.C0BAA1E8C1C@holo.morphisms.net>
One possible use of va_copy is in an implementation of print[f]()
that supports an option to get a specific argument. For example,
print("%2#s %1#s", "second", "first");
prints
first second
For example, one could maintain an array of the first n va_list
items, save them as they are read, and then use the copies when
necessary. The other option is
va_end()
va_start()
while (newcount < count)
va_arg()
which could flood your code.
On Jan 24, 2008, at 5:39 PM, Russ Cox wrote:
>> i didn't see anything in the definition that would make va_copy
>> wrong given the plan 9 definition of va_list. is there a particular
>> case on plan 9 that would be a problem?
>
> it might make sense to *have* va_copy, but since plan 9
> programs don't use va_copy, there's no need to provide
> an implementation. and honestly, the fewer people who
> use va_copy, the better.
>
>> but plan 9 does have va_start and va_end. wouldn't make sense
>> to have va_copy as well?
>
> plan 9 makes no claims of being C99 compliant,
> although it happens to have a few of the same extensions.
> va_start, va_end, and va_arg are from an earlier standard.
> those (in particular va_arg) provide useful functionality.
> va_copy does not.
>
> like i said, if you need it, it's easy to put a #define
> in your own compatibility headers. if you don't
> need it, don't worry about it.
>
> russ
>
next prev parent reply other threads:[~2008-01-24 22:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-24 18:10 erik quanstrom
2008-01-24 22:00 ` Russ Cox
2008-01-24 22:07 ` erik quanstrom
2008-01-24 22:39 ` Russ Cox
2008-01-24 22:45 ` Pietro Gagliardi [this message]
2008-01-24 22:57 ` Charles Forsyth
2008-01-25 9:55 ` Douglas A. Gwyn
2008-01-25 14:18 ` erik quanstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8280E7F9-6119-4570-823D-C920E0EBD50D@mac.com \
--to=pietro10@mac.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).