summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-07-20 23:38:59 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-07-20 23:38:59 +0200
commit1971f613cf20a807da51d2bcc624ef3ef407ceec (patch)
tree981c6f0bb24b7c667ba12181274134a49f77168b
parente71c143cce9a01d3f75db47956ddc21210bc4435 (diff)
ptrdiff_t.3type, size_t.3type, ssize_t.3type: Merge size_t and ssize_t into a single page
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>
-rw-r--r--man3/ptrdiff_t.3type3
-rw-r--r--man3/size_t.3type93
-rw-r--r--man3/ssize_t.3type87
3 files changed, 90 insertions, 93 deletions
diff --git a/man3/ptrdiff_t.3type b/man3/ptrdiff_t.3type
index 7020c2e15..0813fd7a9 100644
--- a/man3/ptrdiff_t.3type
+++ b/man3/ptrdiff_t.3type
@@ -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)
diff --git a/man3/size_t.3type b/man3/size_t.3type
index 602d0572a..226f427c6 100644
--- a/man3/size_t.3type
+++ b/man3/size_t.3type
@@ -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)
diff --git a/man3/ssize_t.3type b/man3/ssize_t.3type
index ed05f0986..492c9ae1a 100644
--- a/man3/ssize_t.3type
+++ b/man3/ssize_t.3type
@@ -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