]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3type/size_t.3type
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3type / size_t.3type
CommitLineData
cb0f97b2 1.\" Copyright (c) 2020-2022 by Alejandro Colomar <alx@kernel.org>
88796fd7
AC
2.\" and Copyright (c) 2020 by Michael Kerrisk <mtk.manpages@gmail.com>
3.\"
4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
5.\"
6.\"
4c1c5274 7.TH size_t 3type (date) "Linux man-pages (unreleased)"
88796fd7 8.SH NAME
1971f613 9size_t, ssize_t \- count of bytes
88796fd7
AC
10.SH LIBRARY
11Standard C library
12.RI ( libc )
13.SH SYNOPSIS
14.nf
15.B #include <stddef.h>
16.PP
17.BR typedef " /* ... */ " size_t;
1971f613
AC
18.PP
19.B #include <sys/types.h>
20.PP
21.BR typedef " /* ... */ " ssize_t;
88796fd7
AC
22.fi
23.SH DESCRIPTION
1971f613
AC
24.TP
25.I size_t
88796fd7
AC
26Used for a count of bytes.
27It is the result of the
28.IR sizeof ()
29operator.
2325c425 30It is an unsigned integer type
88796fd7
AC
31capable of storing values in the range
32.RB [ 0 ,
33.BR SIZE_MAX ].
1971f613
AC
34.TP
35.I ssize_t
f9f25914 36Used for a count of bytes or an error indication.
2325c425 37It is a signed integer type
1971f613
AC
38capable of storing values al least in the range
39.RB [ \-1 ,
40.BR SSIZE_MAX ].
1971f613
AC
41.SS Use with printf(3) and scanf(3)
42.TP
43.I size_t
88796fd7
AC
44The length modifier for
45.I size_t
46for the
47.BR printf (3)
48and the
49.BR scanf (3)
50families of functions is
51.BR z ,
52resulting commonly in
53.B %zu
54or
55.B %zx
56for printing
57.I size_t
58values.
1971f613
AC
59.TP
60.I ssize_t
61Glibc and most other implementations provide a length modifier for
62.I ssize_t
63for the
64.BR printf (3)
65and the
66.BR scanf (3)
67families of functions,
68which is
69.BR z ;
70resulting commonly in
71.B %zd
72or
73.B %zi
74for printing
75.I ssize_t
76values.
77Although
78.B z
79works for
80.I ssize_t
81on most implementations,
82portable POSIX programs should avoid using it\(emfor example,
83by converting the value to
84.I intmax_t
85and using its length modifier
86.RB ( j ).
88796fd7 87.SH VERSIONS
1971f613
AC
88.TP
89.I size_t
88796fd7
AC
90.IR <aio.h> ,
91.IR <glob.h> ,
92.IR <grp.h> ,
93.IR <iconv.h> ,
94.IR <mqueue.h> ,
95.IR <pwd.h> ,
96.IR <signal.h> ,
97and
98.I <sys/socket.h>
99define
100.I size_t
101since POSIX.1-2008.
1971f613
AC
102.TP
103.I ssize_t
104.IR <aio.h> ,
105.IR <mqueue.h> ,
106and
107.I <sys/socket.h>
108define
109.I ssize_t
110since POSIX.1-2008.
3113c7f3 111.SH STANDARDS
1971f613
AC
112.PD 0
113.IR size_t :
801a509d 114C99 and later;
88796fd7 115POSIX.1-2001 and later.
1971f613
AC
116.PP
117.IR ssize_t :
118POSIX.1-2001 and later.
119.PD
88796fd7 120.SH NOTES
1971f613
AC
121.TP
122.I size_t
123The following headers also provide
124.IR size_t :
88796fd7
AC
125.IR <aio.h> ,
126.IR <glob.h> ,
127.IR <grp.h> ,
128.IR <iconv.h> ,
129.IR <monetary.h> ,
130.IR <mqueue.h> ,
131.IR <ndbm.h> ,
132.IR <pwd.h> ,
133.IR <regex.h> ,
134.IR <search.h> ,
135.IR <signal.h> ,
136.IR <stdio.h> ,
137.IR <stdlib.h> ,
138.IR <string.h> ,
139.IR <strings.h> ,
140.IR <sys/mman.h> ,
141.IR <sys/msg.h> ,
142.IR <sys/sem.h> ,
143.IR <sys/shm.h> ,
144.IR <sys/socket.h> ,
145.IR <sys/types.h> ,
146.IR <sys/uio.h> ,
147.IR <time.h> ,
148.IR <unistd.h> ,
149.IR <wchar.h> ,
150and
151.IR <wordexp.h> .
1971f613
AC
152.TP
153.I ssize_t
154The following headers also provide
155.IR ssize_t :
156.IR <aio.h> ,
157.IR <monetary.h> ,
158.IR <mqueue.h> ,
159.IR <stdio.h> ,
160.IR <sys/msg.h> ,
161.IR <sys/socket.h> ,
162.IR <sys/uio.h> ,
163and
164.IR <unistd.h> .
88796fd7
AC
165.SH SEE ALSO
166.BR read (2),
1971f613
AC
167.BR readlink (2),
168.BR readv (2),
169.BR recv (2),
170.BR send (2),
88796fd7
AC
171.BR write (2),
172.BR fread (3),
173.BR fwrite (3),
174.BR memcmp (3),
175.BR memcpy (3),
176.BR memset (3),
177.BR offsetof (3),
1971f613 178.BR ptrdiff_t (3type)