BOOL
typedefsignedchar BOOL;
#define YES (BOOL)1
#define NO (BOOL)0
bool
C99标准定义了一个新的关键字_Bool,提供了布尔类型
#define bool _Bool
#define true 1
#define false 0
Boolean
typedef unsigned char Boolean;
enumDYLD_BOOL {FALSE,TRUE };
总结
下面的表格更能表现上面三种布尔类型的真值类型和数值:
Name | Typedef | Header | True Value | False Value |
BOOL | signed char | objc.h | YES | NO |
bool | _Bool | stdbool.h | true | false |
Boolean | unsigned char | MacTypes.h | TRUE | FALSE |