bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] idx: new printf/scanf length modifier macro
Date: Mon, 14 Jun 2021 16:47:48 -0700	[thread overview]
Message-ID: <20210614234748.41764-1-eggert@cs.ucla.edu> (raw)

* 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  <eggert@cs.ucla.edu>
+
+	idx: new printf/scanf length modifier macro
+	* lib/idx.h (pIDX): New macro.
+
 2021-06-13  Bruno Haible  <bruno@clisp.org>
 
 	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
 
+/* A printf/scanf length modifier for idx_t.  For example, if i is an idx_t,
+   printf ("i = %"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.  */
-- 
2.30.2



             reply	other threads:[~2021-06-14 23:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 23:47 Paul Eggert [this message]
2021-06-15  0:55 ` [PATCH] idx: new printf/scanf length modifier macro Bruno Haible
2021-06-15 17:32   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210614234748.41764-1-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).