基本数据类型
c 标准类型
平台无关类型
typedef类型
各自优缺点
- 标准类型可能跨平台不好,特别的,用
long int
类型代表指针的类型。 <linux/types.h>
中有u8,u16,u32
。C99标准有uint8_t
。- typedef类型在打印时,尽量往大的类型转。
其他问题
- 时间间隔
- 字节序
- 数据对齐
- 指针和错误*
- 内存页面*
数据结构
<linux/list.h>
中规定了list_head
结构体,可以内嵌到其他数据结构中。并使用list_entry(struct list_head *ptr, type_of_struct,field_name);
通过 entry
节点得到 链表以外的大结构体。