本文主要涉及到的库文件位于/usr/include/bits目录下,文件包括wordsize.h,types.h,typesizes.h 等文件。
wordsize.h中主要定义了当前机器的字大小。内容如下:
...
#define __WORDSIZE 32
...
这里的宏应该是安装系统的时候,确定的机器字的大小,然后才生成对应的宏。这个宏会在types.h中作为判定条件,从而定义相应数据类型。我们可以看下types.h文件有如下内容:
99 #define __S16_TYPE short int
100 #define __U16_TYPE unsigned short int
101 #define __S32_TYPE int
102 #define __U32_TYPE unsigned int
103 #define __SLONGWORD_TYPE long int
104 #define __ULONGWORD_TYPE unsigned long int
//以上类型定义与机器字长度无关
105 #if __WORDSIZE == 32
106 # define __SQUAD_TYPE __quad_t
107 # define __UQUAD_TYPE __u_quad_t
108 # define __SWORD_TYPE int
109 # define __UWORD_TYPE unsigned int
110 # define __SLONG32_TYPE