]> Savannah Git Hosting - gnulib.git/commitdiff
idx: new printf/scanf length modifier macro
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Jun 2021 23:46:34 +0000 (16:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Jun 2021 23:47:23 +0000 (16:47 -0700)
* lib/idx.h (pIDX): New macro.

ChangeLog
lib/idx.h

index b98de6bf6ad09f0c8fdcedc77eaf086130311c34..4e8242adeabf10ef18ddc4df97ad901a05e1d1fa 100644 (file)
--- 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).
index 483587eabbdda18e7beba376199493c2d5b73747..28fd4ea72a9bc1bca0de14267341adfe5fb1b9eb 100644 (file)
--- 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.  */