size_t(3type) — Linux manual page

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | STANDARDS | HISTORY | NOTES | SEE ALSO | COLOPHON

size_t(3type)                                              size_t(3type)

NAME         top

       size_t, ssize_t - count of bytes

LIBRARY         top

       Standard C library (libc)

SYNOPSIS         top

       #include <stddef.h>

       typedef /* ... */  size_t;

       #include <sys/types.h>

       typedef /* ... */  ssize_t;

DESCRIPTION         top

       size_t Used for a count of bytes.  It is the result of the
              sizeof() operator.  It is an unsigned integer type capable
              of storing values in the range [0, SIZE_MAX].

       ssize_t
              Used for a count of bytes or an error indication.  It is a
              signed integer type capable of storing values at least in
              the range [-1, SSIZE_MAX].

   Use with printf(3) and scanf(3)
       size_t The length modifier for size_t for the printf(3) and the
              scanf(3) families of functions is z, resulting commonly in
              %zu or %zx for printing size_t values.

       ssize_t
              glibc and most other implementations provide a length
              modifier for ssize_t for the printf(3) and the scanf(3)
              families of functions, which is z; resulting commonly in
              %zd or %zi for printing ssize_t values.  Although z works
              for ssize_t on most implementations, portable POSIX
              programs should avoid using it—for example, by converting
              the value to intmax_t and using its length modifier (j).

STANDARDS         top

       size_t C11, POSIX.1-2008.

       ssize_t
              POSIX.1-2008.

HISTORY         top

       size_t C89, POSIX.1-2001.

       ssize_t
              POSIX.1-2001.

       <aio.h>, <glob.h>, <grp.h>, <iconv.h>, <mqueue.h>, <pwd.h>,
       <signal.h>, and <sys/socket.h> define size_t since POSIX.1-2008.

       <aio.h>, <mqueue.h>, and <sys/socket.h> define ssize_t since
       POSIX.1-2008.

NOTES         top

       size_t The following headers also provide size_t: <aio.h>,
              <glob.h>, <grp.h>, <iconv.h>, <monetary.h>, <mqueue.h>,
              <ndbm.h>, <pwd.h>, <regex.h>, <search.h>, <signal.h>,
              <stdio.h>, <stdlib.h>, <string.h>, <strings.h>,
              <sys/mman.h>, <sys/msg.h>, <sys/sem.h>, <sys/shm.h>,
              <sys/socket.h>, <sys/types.h>, <sys/uio.h>, <time.h>,
              <unistd.h>, <wchar.h>, and <wordexp.h>.

       ssize_t
              The following headers also provide ssize_t: <aio.h>,
              <monetary.h>, <mqueue.h>, <stdio.h>, <sys/msg.h>,
              <sys/socket.h>, <sys/uio.h>, and <unistd.h>.

SEE ALSO         top

       read(2), readlink(2), readv(2), recv(2), send(2), write(2),
       fread(3), fwrite(3), memcmp(3), memcpy(3), memset(3),
       offsetof(3), ptrdiff_t(3type)

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.9.1.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2024-06-26.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       [email protected]

Linux man-pages 6.9.1          2024-05-02                  size_t(3type)

Pages that refer to this page: ptrdiff_t(3type)