From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.tuxteam.de (mail.tuxteam.de [5.199.139.25]) by sourceware.org (Postfix) with ESMTPS id 67376388E811 for ; Tue, 11 May 2021 17:26:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 67376388E811 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tuxteam.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tomas@tuxteam.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:Date; bh=Aik1LR/+p1MCaZsmjE75rAwxUz3hFr6y0qAN8DiHLyM=; b=LIRIjofBVDAhemQ3s0Z+A4ZdDEAUZJ97JrPFPpKtAkhv1kOTEK3f798NNvUOhXdksshQsBAR2jqwZGlcJnI+k3MBIJeuSyTlg+1QBHT9BVMAxFIBgOV7bXHfXarCq3sPafZ8mu9J+RT74IaatI9m2ggqYG9f+EToA0CYx8ckoxhMBH0PK0sa/b0zSs1oCsQx9/Y/g33o4+Vtw4Wn4RLaRdjK2AjGcMqIofQNZg1cgNsjvjW1+fwyYti1YkIg1fObKj/XiXhGGWLxhcRSnK9HWqbeyDrR3s1rfiOae9pBDtxrjKc2v5qNIvBmdotX2mJuAR50Be1B/NFE7Eyjj//m7w==; Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1lgW9E-0005P8-Uk; Tue, 11 May 2021 19:26:20 +0200 Date: Tue, 11 May 2021 19:26:20 +0200 To: Peng Yu Cc: libc-help@sourceware.org Subject: Re: What does ap in printf(3) stand for? Message-ID: <20210511172620.GD15367@tuxteam.de> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IDYEmSnFhs3mNXr+" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, 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 17:26:32 -0000 --IDYEmSnFhs3mNXr+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > 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 --IDYEmSnFhs3mNXr+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmCavjwACgkQBcgs9XrR2kYeAgCfcIB+hCh9QiU0cGSkPLMn4tHy XQ0An0WJo9Lv10XCD3HfXfo1exuSB5y6 =tdjr -----END PGP SIGNATURE----- --IDYEmSnFhs3mNXr+--