public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Peng Yu <pengyu.ut@gmail.com>
To: tomas@tuxteam.de
Cc: libc-help@sourceware.org
Subject: Re: What does ap in printf(3) stand for?
Date: Tue, 11 May 2021 16:09:41 -0500	[thread overview]
Message-ID: <CABrM6wmttvzQTLHYEXrMQ6KLAwgz55OH3Y+8rrrVxRavL1-h1A@mail.gmail.com> (raw)
In-Reply-To: <20210511172620.GD15367@tuxteam.de>

You misunderstood my question. I literally mean what the two letters
"a" and "p" stand for respectively.

Just like "E", "O" and "F" in "EOF" stand for "end", "of" and "file",
respectively.

My guess is "a" stands for "argument", but then it should be a list.
Thus it should be called "al" instead of "ap". So I don't understand
what "p" stands for.

On 5/11/21, tomas@tuxteam.de <tomas@tuxteam.de> wrote:
> 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
>


-- 
Regards,
Peng

  reply	other threads:[~2021-05-11 21:09 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
2021-05-11 21:09   ` Peng Yu [this message]
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=CABrM6wmttvzQTLHYEXrMQ6KLAwgz55OH3Y+8rrrVxRavL1-h1A@mail.gmail.com \
    --to=pengyu.ut@gmail.com \
    --cc=libc-help@sourceware.org \
    --cc=tomas@tuxteam.de \
    /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).