C++ basic data types

I was a little confused when I saw uint32_t today, so I went to check it out. . .

as follows:

So what exactly does uint32_t represent?

In fact, these data types uint8_t / uint16_t / uint32_t /uint64_t are defined in C99:

/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char             int8_t; 
typedef short int               int16_t;
typedef int                     int32_t;
# if __WORDSIZE == 64
typedef long int                int64_t;
# else
__extension__
typedef long long int           int64_t;
# endif
#endif
 
/* Unsigned.  */
typedef unsigned char           uint8_t;
typedef unsigned short int      uint16_t;
#ifndef __uint32_t_defined
typedef unsigned int            uint32_t;
# define __uint32_t_defined
#endif
#if __WORDSIZE == 64
typedef unsigned long int       uint64_t;
#else
__extension__
typedef unsigned long long int  uint64_t;
#endif

That is, uint8_t is actually a char, and uint32_t is unsigned int (and so on).

Guess you like

Origin blog.csdn.net/LearnToStick/article/details/129156000