]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
ptrdiff_t.3type, size_t.3type, ssize_t.3type: Merge size_t and ssize_t into a single...
authorAlejandro Colomar <alx.manpages@gmail.com>
Wed, 20 Jul 2022 21:38:59 +0000 (23:38 +0200)
committerAlejandro Colomar <alx.manpages@gmail.com>
Wed, 20 Jul 2022 21:38:59 +0000 (23:38 +0200)
Since ssize_t is just the signed version of size_t,
it makes sense to document them together.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
man3/ptrdiff_t.3type
man3/size_t.3type
man3/ssize_t.3type

index 7020c2e15981f6e4654c58f32d80935cb4164f99..0813fd7a9c5ee014222cb64a3781784ef45ca5e1 100644 (file)
@@ -44,5 +44,4 @@ values.
 C99 and later.
 POSIX.1-2001 and later.
 .SH SEE ALSO
-.BR size_t (3type),
-.BR ssize_t (3type)
+.BR size_t (3type)
index 602d0572a9755fad69eab533a8636808a5f4bba2..226f427c6ff50f78818c280eb114345b9417ee25 100644 (file)
@@ -6,7 +6,7 @@
 .\"
 .TH SIZE_T 3type 2022-07-20 Linux "Linux Programmer's Manual"
 .SH NAME
-size_t \- count of bytes
+size_t, ssize_t \- count of bytes
 .SH LIBRARY
 Standard C library
 .RI ( libc )
@@ -15,8 +15,14 @@ Standard C library
 .B #include <stddef.h>
 .PP
 .BR typedef " /* ... */  " size_t;
+.PP
+.B #include <sys/types.h>
+.PP
+.BR typedef " /* ... */  " ssize_t;
 .fi
 .SH DESCRIPTION
+.TP
+.I size_t
 Used for a count of bytes.
 It is the result of the
 .IR sizeof ()
@@ -26,13 +32,26 @@ it shall be an unsigned integer type
 capable of storing values in the range
 .RB [ 0 ,
 .BR SIZE_MAX ].
+.TP
+.I ssize_t
+Used for a cout of bytes or an error indication.
+According to POSIX,
+it shall be a signed integer type
+capable of storing values al least in the range
+.RB [ \-1 ,
+.BR SSIZE_MAX ].
+.PP
 According to POSIX,
 the implementation shall support one or more programming environments
 where the width of
 .I size_t
+and
+.I ssize_t
 is no greater than the width of the type
 .IR long .
-.PP
+.SS Use with printf(3) and scanf(3)
+.TP
+.I size_t
 The length modifier for
 .I size_t
 for the
@@ -48,7 +67,37 @@ or
 for printing
 .I size_t
 values.
+.TP
+.I ssize_t
+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\(emfor example,
+by converting the value to
+.I intmax_t
+and using its length modifier
+.RB ( j ).
 .SH VERSIONS
+.TP
+.I size_t
 .IR <aio.h> ,
 .IR <glob.h> ,
 .IR <grp.h> ,
@@ -61,11 +110,29 @@ and
 define
 .I size_t
 since POSIX.1-2008.
+.TP
+.I ssize_t
+.IR <aio.h> ,
+.IR <mqueue.h> ,
+and
+.I <sys/socket.h>
+define
+.I ssize_t
+since POSIX.1-2008.
 .SH CONFORMING TO
+.PD 0
+.IR size_t :
 C99 and later.
 POSIX.1-2001 and later.
+.PP
+.IR ssize_t :
+POSIX.1-2001 and later.
+.PD
 .SH NOTES
-The following headers also provide this type:
+.TP
+.I size_t
+The following headers also provide
+.IR size_t :
 .IR <aio.h> ,
 .IR <glob.h> ,
 .IR <grp.h> ,
@@ -93,8 +160,25 @@ The following headers also provide this type:
 .IR <wchar.h> ,
 and
 .IR <wordexp.h> .
+.TP
+.I ssize_t
+The following headers also provide
+.IR ssize_t :
+.IR <aio.h> ,
+.IR <monetary.h> ,
+.IR <mqueue.h> ,
+.IR <stdio.h> ,
+.IR <sys/msg.h> ,
+.IR <sys/socket.h> ,
+.IR <sys/uio.h> ,
+and
+.IR <unistd.h> .
 .SH SEE ALSO
 .BR read (2),
+.BR readlink (2),
+.BR readv (2),
+.BR recv (2),
+.BR send (2),
 .BR write (2),
 .BR fread (3),
 .BR fwrite (3),
@@ -102,5 +186,4 @@ and
 .BR memcpy (3),
 .BR memset (3),
 .BR offsetof (3),
-.BR ptrdiff_t (3type),
-.BR ssize_t (3type)
+.BR ptrdiff_t (3type)
index ed05f098644cff1915406ca8ae2fad487befd0b0..492c9ae1aa39eb7913a8b6893a457ab82fbf36fa 100644 (file)
@@ -1,86 +1 @@
-.\" Copyright (c) 2020-2022 by Alejandro Colomar <colomar.6.4.3@gmail.com>
-.\" and Copyright (c) 2020 by Michael Kerrisk <mtk.manpages@gmail.com>
-.\"
-.\" SPDX-License-Identifier: Linux-man-pages-copyleft
-.\"
-.\"
-.TH SSIZE_T 3type 2022-06-17 Linux "Linux Programmer's Manual"
-.SH NAME
-ssize_t \- count of bytes or an error indication
-.SH LIBRARY
-Standard C library
-.RI ( libc )
-.SH SYNOPSIS
-.nf
-.B #include <sys/types.h>
-.PP
-.BR typedef " /* ... */ " ssize_t;
-.fi
-.SH DESCRIPTION
-Used for a count of bytes or an error indication.
-According to POSIX,
-it shall be a signed integer type
-capable of storing values at least in the range
-.RB [ \-1 ,
-.BR SSIZE_MAX ],
-and the implementation shall support one or more programming environments
-where the width of
-.I ssize_t
-is no greater than the width of the type
-.IR long .
-.PP
-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\(emfor example,
-by converting the value to
-.I intmax_t
-and using its length modifier
-.RB ( j ).
-.SH VERSIONS
-.IR <aio.h> ,
-.IR <mqueue.h> ,
-and
-.I <sys/socket.h>
-define
-.I ssize_t
-since POSIX.1-2008.
-.SH CONFORMING TO
-POSIX.1-2001 and later.
-.SH NOTES
-The following headers also provide this type:
-.IR <aio.h> ,
-.IR <monetary.h> ,
-.IR <mqueue.h> ,
-.IR <stdio.h> ,
-.IR <sys/msg.h> ,
-.IR <sys/socket.h> ,
-.IR <sys/uio.h> ,
-and
-.IR <unistd.h> .
-.SH SEE ALSO
-.BR read (2),
-.BR readlink (2),
-.BR readv (2),
-.BR recv (2),
-.BR send (2),
-.BR write (2),
-.BR ptrdiff_t (3type),
-.BR size_t (3type)
+.so man3/size_t.3type