public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* What does ap in printf(3) stand for?
@ 2021-05-11 16:50 Peng Yu
  2021-05-11 17:26 ` tomas
  2021-05-11 22:53 ` Sergey Organov
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Yu @ 2021-05-11 16:50 UTC (permalink / raw)
  To: libc-help

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.

-- 
Regards,
Peng

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What does ap in printf(3) stand for?
  2021-05-11 16:50 What does ap in printf(3) stand for? Peng Yu
@ 2021-05-11 17:26 ` tomas
  2021-05-11 21:09   ` Peng Yu
  2021-05-11 22:53 ` Sergey Organov
  1 sibling, 1 reply; 4+ messages in thread
From: tomas @ 2021-05-11 17:26 UTC (permalink / raw)
  To: Peng Yu; +Cc: libc-help

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What does ap in printf(3) stand for?
  2021-05-11 17:26 ` tomas
@ 2021-05-11 21:09   ` Peng Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Yu @ 2021-05-11 21:09 UTC (permalink / raw)
  To: tomas; +Cc: libc-help

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What does ap in printf(3) stand for?
  2021-05-11 16:50 What does ap in printf(3) stand for? Peng Yu
  2021-05-11 17:26 ` tomas
@ 2021-05-11 22:53 ` Sergey Organov
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Organov @ 2021-05-11 22:53 UTC (permalink / raw)
  To: libc-help

Peng Yu via Libc-help
<libc-help@sourceware.org> writes:

> 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.

ap == argument pointer:

https://stackoverflow.com/questions/24345199/what-does-ap-stand-for-in-c-examples

-- Sergey Organov


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-11 22:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 16:50 What does ap in printf(3) stand for? Peng Yu
2021-05-11 17:26 ` tomas
2021-05-11 21:09   ` Peng Yu
2021-05-11 22:53 ` Sergey Organov

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).