typedf bool BOOL

来源:百度知道 编辑:UC知道 时间:2024/09/22 21:13:26
typedf bool BOOL;//作用是什么?

typedef bool BOOL;

功能上是和
#define BOOL bool
一样。

但是宏定义,是在编译的时候就把代码中所有的BOOL都替换成bool编译。
但是typedef bool BOOL; 是运行时的,把BOOL作为一个新类型,和bool是同一个类型。