有些时候我们再编写代码或者阅读开源项目时经常会遇到一些陌生的宏定义,在找遍所有源代码都没发现其在哪里被定义过,这时,这些宏很可能是系统编译器自己定义的。
比如:在OneNet平台(http://open.iot.10086.cn/)提供的EDP协议C语言版的SDK中,common.h头文件中有这样的定义
- #if defined(_LINUX) || defined (WIN32)
- typedef unsigned char uint8;
- typedef char int8;
- typedef unsigned short uint16;
- typedef short int16;
- typedef unsigned int uint32;