From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 411A91F5AE for ; Mon, 14 Jun 2021 23:48:04 +0000 (UTC) Received: from localhost ([::1]:39318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lswJH-0000Qg-4W for normalperson@yhbt.net; Mon, 14 Jun 2021 19:48:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lswJC-0000QR-Vr for bug-gnulib@gnu.org; Mon, 14 Jun 2021 19:47:59 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lswJA-0000R8-PI for bug-gnulib@gnu.org; Mon, 14 Jun 2021 19:47:58 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 793D0160126 for ; Mon, 14 Jun 2021 16:47:54 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FAwMZCD6Cuu5; Mon, 14 Jun 2021 16:47:53 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AC1CD160124; Mon, 14 Jun 2021 16:47:53 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X0CHR7K_71qn; Mon, 14 Jun 2021 16:47:53 -0700 (PDT) Received: from day.example.com (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 88DEC160120; Mon, 14 Jun 2021 16:47:53 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH] idx: new printf/scanf length modifier macro Date: Mon, 14 Jun 2021 16:47:48 -0700 Message-Id: <20210614234748.41764-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * lib/idx.h (pIDX): New macro. --- ChangeLog | 5 +++++ lib/idx.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index b98de6bf6..4e8242ade 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-06-14 Paul Eggert + + idx: new printf/scanf length modifier macro + * lib/idx.h (pIDX): New macro. + 2021-06-13 Bruno Haible =20 Align 2011-11-26 patch to 2021-04-11 patch (regression from 2021-04-11)= . diff --git a/lib/idx.h b/lib/idx.h index 483587eab..28fd4ea72 100644 --- a/lib/idx.h +++ b/lib/idx.h @@ -107,6 +107,10 @@ typedef ptrdiff_t idx_t; /* IDX_MAX is the maximum value of an idx_t. */ #define IDX_MAX PTRDIFF_MAX =20 +/* A printf/scanf length modifier for idx_t. For example, if i is an id= x_t, + printf ("i =3D %"pIDX"d\n", i) outputs i's value. */ +#define pIDX "t" + /* So far no need has been found for an IDX_WIDTH macro. Perhaps there should be another macro IDX_VALUE_BITS that does not count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ --=20 2.30.2