1size_t(3type) size_t(3type)
2
3
4
6 size_t, ssize_t - count of bytes
7
9 Standard C library (libc)
10
12 #include <stddef.h>
13
14 typedef /* ... */ size_t;
15
16 #include <sys/types.h>
17
18 typedef /* ... */ ssize_t;
19
21 size_t Used for a count of bytes. It is the result of the sizeof() op‐
22 erator. It is an unsigned integer type capable of storing val‐
23 ues in the range [0, SIZE_MAX].
24
25 ssize_t
26 Used for a count of bytes or an error indication. It is a
27 signed integer type capable of storing values at least in the
28 range [-1, SSIZE_MAX].
29
30 Use with printf(3) and scanf(3)
31 size_t The length modifier for size_t for the printf(3) and the
32 scanf(3) families of functions is z, resulting commonly in %zu
33 or %zx for printing size_t values.
34
35 ssize_t
36 glibc and most other implementations provide a length modifier
37 for ssize_t for the printf(3) and the scanf(3) families of func‐
38 tions, which is z; resulting commonly in %zd or %zi for printing
39 ssize_t values. Although z works for ssize_t on most implemen‐
40 tations, portable POSIX programs should avoid using it—for exam‐
41 ple, by converting the value to intmax_t and using its length
42 modifier (j).
43
45 size_t C11, POSIX.1-2008.
46
47 ssize_t
48 POSIX.1-2008.
49
51 size_t C89, POSIX.1-2001.
52
53 ssize_t
54 POSIX.1-2001.
55
56 <aio.h>, <glob.h>, <grp.h>, <iconv.h>, <mqueue.h>, <pwd.h>, <signal.h>,
57 and <sys/socket.h> define size_t since POSIX.1-2008.
58
59 <aio.h>, <mqueue.h>, and <sys/socket.h> define ssize_t since
60 POSIX.1-2008.
61
63 size_t The following headers also provide size_t: <aio.h>, <glob.h>,
64 <grp.h>, <iconv.h>, <monetary.h>, <mqueue.h>, <ndbm.h>, <pwd.h>,
65 <regex.h>, <search.h>, <signal.h>, <stdio.h>, <stdlib.h>,
66 <string.h>, <strings.h>, <sys/mman.h>, <sys/msg.h>, <sys/sem.h>,
67 <sys/shm.h>, <sys/socket.h>, <sys/types.h>, <sys/uio.h>,
68 <time.h>, <unistd.h>, <wchar.h>, and <wordexp.h>.
69
70 ssize_t
71 The following headers also provide ssize_t: <aio.h>, <mone‐
72 tary.h>, <mqueue.h>, <stdio.h>, <sys/msg.h>, <sys/socket.h>,
73 <sys/uio.h>, and <unistd.h>.
74
76 read(2), readlink(2), readv(2), recv(2), send(2), write(2), fread(3),
77 fwrite(3), memcmp(3), memcpy(3), memset(3), offsetof(3),
78 ptrdiff_t(3type)
79
80
81
82Linux man-pages 6.04 2023-03-31 size_t(3type)