From: Paul Eggert Date: Mon, 14 Jun 2021 23:46:34 +0000 (-0700) Subject: idx: new printf/scanf length modifier macro X-Git-Tag: v1.0~2811 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=2468c9488c65003ef30f3b50f1f0104720e41c18;p=gnulib.git idx: new printf/scanf length modifier macro * lib/idx.h (pIDX): New macro. --- diff --git a/ChangeLog b/ChangeLog index b98de6bf6a..4e8242adea 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 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 483587eabb..28fd4ea72a 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. */