Differences between size_t and ssie_t

Source: Internet
Author: User

There is a very detailed search and definition process on the internet, and I have done it myself.

Process: 1. First in/usr/include/i386-linux-gun find

# Ifndef _ ssize_t _ defined typedef _ ssize_t

2. There are no relevant clues in the file, but there are # include <bits/types. h> to view.

Locate _ std_type1_ssize_t_type _ ssize_t

The file contains # DEFINE _ std_type _ extension _ typedef.

SO _ std_type1_ssize_t_type _ ssize_t is equivalent:

Typedef _ ssize_t_type _ ssize_t

3. The file contains the header file # include <bits/typesize. h>/* defines _ * _ t_type macros */

4. Check typessize. h and find # DEFINE _ ssize_t_type _ sword_type.

5. At the current position, the result is that the initial typedef _ ssize_t is equivalent to typedef _ sword_type ssize_t.

6. In bits/types. h

        

 1 #if __WORDSIZE == 32 2 # define __SQUAD_TYPE     __quad_t 3 # define __UQUAD_TYPE     __u_quad_t 4 # define __SWORD_TYPE     int 5 # define __UWORD_TYPE     unsigned int 6 # define __SLONG32_TYPE     long int 7 # define __ULONG32_TYPE     unsigned long int 8 # define __S64_TYPE     __quad_t 9 # define __U64_TYPE     __u_quad_t10 /* We want __extension__ before typedef‘s that use nonstandard base types11 such as `long long‘ in C89 mode. */12 # define __STD_TYPE     __extension__ typedef13 #elif __WORDSIZE == 6414 # define __SQUAD_TYPE     long int15 # define __UQUAD_TYPE     unsigned long int16 # define __SWORD_TYPE     long int17 # define __UWORD_TYPE     unsigned long int18 # define __SLONG32_TYPE     int19 # define __ULONG32_TYPE     unsigned int20 # define __S64_TYPE     long int21 # define __U64_TYPE     unsigned long int22 /* No need to mark the typedef with __extension__. */23 # define __STD_TYPE     typedef24 #else25 # error26 #endif

So the result is that ssize_t is equivalent to int (4 bytes) on 32-bit machines, and 64-bit is equivalent to long int (8 bytes)

Size_t is the unsigned ssize_t, Which is unsigned int/unsigned long on 32-bit machines (based on the compiler, but both are 32-bit ),

On 64-bit machines, it is 64-bit.

Differences between size_t and ssie_t

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.