首页 > 代码库 > For 32-bit BOOL is a signed char, whereas under 64-bit it is a bool.

For 32-bit BOOL is a signed char, whereas under 64-bit it is a bool.

https://stackoverflow.com/questions/31267325/bool-with-64-bit-on-ios/31270249#31270249

Definition of BOOL from objc.h:

/// Type to represent a boolean value.
#if (TARGET_OS_IPHONE && __LP64__)  ||  TARGET_OS_WATCH
#define OBJC_BOOL_IS_BOOL 1
typedef bool BOOL;
#else
#define OBJC_BOOL_IS_CHAR 1
typedef signed char BOOL; 
// BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C" 
// even if -funsigned-char is used.
#endif

For 32-bit BOOL is a signed char, whereas under 64-bit it is a bool.