From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id 3BEB8385800A for ; Tue, 11 May 2021 21:09:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3BEB8385800A Received: by mail-io1-xd2e.google.com with SMTP id t3so19514675iol.5 for ; Tue, 11 May 2021 14:09:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EGdRgy8cmiA0uHKN0bSJw++Gcu9poNMOTFUZ5YUiqlE=; b=hnPFBsjCm3Ev6JOPGieJSVSGXqz5Xmc4kouwmfzCN3CdzyoHziBl9gv/eEEhM80XsV gqT/gytBOLm5bCZgMlsdXegJkAXI21RQ4DRopY/suCyzmlpMhOsJkx3gEMEGd8weQkra Rck4KIwmW0h5KWqI5L6ycGlVoszIYj+8kOwuHJ4kGrD86FcoPo0LHSgQH9eyhIQodhuv M4HxK9j5eWInfj4uA7dXnlQc24MXur+k5X3kWE/QYGSrP6QV7OMYZh3gVUvFymYwFK0u P6+oDNaXizP3kVgYD6TysvpyjAVRk/6igPx0u+bTkC8AcjQYlgf6PSmTqgJsC1k8UFiv UqbA== X-Gm-Message-State: AOAM5310LdS+n7IV6nCiOzgWeI1tjY13iXnb0hyjyOUlax+D3PfH0C+k pO2SAZgD0IH0BqQCq+Uc1q05bK0bFmaiYg5E4WH2sy+tRzA= X-Google-Smtp-Source: ABdhPJwTM/IrBBMXfmV/tmKj4l3jStQXA0TbLiI2SZ3JDe8KhTofunkd2ubeUzUgtX5vBf2JQ3RaJQrTZlj8xP/7VC8= X-Received: by 2002:a5d:9694:: with SMTP id m20mr23810838ion.40.1620767381797; Tue, 11 May 2021 14:09:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5e:d714:0:0:0:0:0 with HTTP; Tue, 11 May 2021 14:09:41 -0700 (PDT) In-Reply-To: <20210511172620.GD15367@tuxteam.de> References: <20210511172620.GD15367@tuxteam.de> From: Peng Yu Date: Tue, 11 May 2021 16:09:41 -0500 Message-ID: Subject: Re: What does ap in printf(3) stand for? To: tomas@tuxteam.de Cc: libc-help@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 21:09:43 -0000 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 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