system_data_types.7: Specify the length modifiers for the variables that have them

Reported-by: Florian Weimer <fweimer@redhat.com>
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2020-09-20 20:14:08 +02:00 committed by Michael Kerrisk
parent fce28f1448
commit 1a6e6d4012
1 changed files with 56 additions and 0 deletions

View File

@ -108,6 +108,22 @@ capable of storing values in the range
.BR "" [ PTRDIFF_MIN ,
.BR PTRDIFF_MAX ].
.IP
The length modifier for
.I ptrdiff_t
for the
.BR printf (3)
and the
.BR scanf (3)
families of functions is
.BR t ;
resulting commonly in
.B %td
or
.B %ti
for printing
.I ptrdiff_t
values.
.IP
Conforming to: C99 and later; POSIX.1-2001 and later.
.IP
See also the
@ -344,6 +360,22 @@ it shall be an unsigned integer type
capable of storing values in the range [0,
.BR SIZE_MAX ].
.IP
The length modifier for
.I size_t
for the
.BR printf (3)
and the
.BR scanf (3)
families of functions is
.BR z ;
resulting commonly in
.B %zu
or
.B %zx
for printing
.I size_t
values.
.IP
Conforming to: C99 and later; POSIX.1-2001 and later.
.IP
Notes:
@ -404,6 +436,30 @@ According to POSIX, it shall be a signed integer type
capable of storing values at least in the range [-1,
.BR SSIZE_MAX ].
.IP
Glibc and most other implementations provide a length modifier for
.I ssize_t
for the
.BR printf (3)
and the
.BR scanf (3)
families of functions, which is
.BR z ;
resulting commonly in
.B %zd
or
.B %zi
for printing
.I ssize_t
values.
Although
.B z
works for
.I ssize_t
on most implementations, portable POSIX programs should avoid using it,
e.g., by converting the value to
.I intmax_t
and using its length modifier.
.IP
Conforming to: POSIX.1-2001 and later.
.IP
See also: