From: <tomas@tuxteam.de>
To: Peng Yu <pengyu.ut@gmail.com>
Cc: libc-help@sourceware.org
Subject: Re: What does ap in printf(3) stand for?
Date: Tue, 11 May 2021 19:26:20 +0200 [thread overview]
Message-ID: <20210511172620.GD15367@tuxteam.de> (raw)
In-Reply-To: <CABrM6wm9utdmJi_5acQ4q=h049ViBFKa8v6nx=k00Mjzxv7zJA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 966 bytes --]
On Tue, May 11, 2021 at 11:50:20AM -0500, Peng Yu via Libc-help wrote:
> https://man7.org/linux/man-pages/man3/printf.3.html
>
> It is not clear what "ap" stands for in printf(3). Could anybody
> explain what it stands for? Thanks.
This is for the v*printf group. The ap is a va_list in the sense of
stdarg. Let me quote the man page:
"The functions vprintf(), vfprintf(), vdprintf(), vsprintf(),
vsnprintf() are equivalent to the functions printf(),
fprintf(), dprintf(), sprintf(), snprintf(), respectively,
except that they are called with a va_list instead of a
variable number of arguments. These functions do not call
the va_end macro. Because they invoke the va_arg macro,
the value of ap is undefined after the call. See stdarg(3)."
They are typically used if you want to somehow leverage or extend
printf: you unwrap the parameters "the stdarg way" and pass on
whatever is left to v*printf.
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2021-05-11 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 16:50 Peng Yu
2021-05-11 17:26 ` tomas [this message]
2021-05-11 21:09 ` Peng Yu
2021-05-11 22:53 ` Sergey Organov
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=20210511172620.GD15367@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=libc-help@sourceware.org \
--cc=pengyu.ut@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).