What does ap in printf(3) stand for?

Peng Yu pengyu.ut@gmail.com
Tue May 11 21:09:41 GMT 2021


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


More information about the Libc-help mailing list