programing

리눅스에서 ssize_t는 어디에서 정의됩니까?

instargram 2023. 10. 19. 21:52
반응형

리눅스에서 ssize_t는 어디에서 정의됩니까?

OS: 데비안 9 (리눅스 4.9)

컴파일러: GCC 8.2

현재 포함하고 있습니다.<stddef.h>(어디에size_t정의됨) 및<stdint.h>(대부분의 적분형이 정의되는 곳에서) 하지만 아직도 나는ssize_t.

어디에 정의되어 있습니까?

ssize_t에 정의됩니다.sys/types.h.

POSIX 설명서에 따라 다음을 수행합니다.

이름.

sys/types.h - 데이터 유형

SYNOPIS

#include <sys/types.h>

묘사

헤더는 적어도 다음과 같은 유형을 정의해야 합니다.

...

ssize_t

바이트 수 또는 오류 표시에 사용됩니다.

리눅스 man-pages 문서 시스템 데이터 유형은 5.9 버전부터 중앙 집중식으로 쉽게 찾을 수 있습니다.

유형만 입력합니다.

ssize_t(3type)      Linux Programmer’s Manual     ssize_t(3type)

NAME
       ssize_t - count of bytes or an error indication

LIBRARY
       Standard C library (libc)

SYNOPSIS
       #include <sys/types.h>

       typedef /* ... */ ssize_t;

DESCRIPTION
       Used  for  a  count of bytes or an error indication.  Ac‐
       cording to POSIX, it shall be a signed integer type capa‐
       ble  of  storing  values  at  least  in  the  range  [-1,
       SSIZE_MAX],  and  the implementation shall support one or
       more programming environments where the width of  ssize_t
       is no greater than the width of the type long.

       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  pro‐
       grams  should  avoid  using it—for example, by converting
       the value to intmax_t and using its length modifier (j).

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

CONFORMING TO
       POSIX.1‐2001 and later.

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

SEE ALSO
       read(2),   readlink(2),   readv(2),   recv(2),   send(2),
       write(2), ptrdiff_t(3type), size_t(3type)

Linux                      2022‐06‐17             ssize_t(3type)

당신이 원한다면,ssize_t, 포함해야 합니다.<sys/types.h>, 이것은 표준 헤더이며, 아마도 가장 가벼운 헤더일 것입니다.ssize_t. 그러나 문서화된 모든 헤더에서 제공되므로 다른 헤더 중 하나에 정의가 필요한 경우 해당 다른 헤더만 포함할 수 있습니다.

언급URL : https://stackoverflow.com/questions/55190317/where-is-ssize-t-defined-in-linux

반응형