布尔

var OBJC_BOOL_IS_BOOL: Int32 { get }

#if OBJC_BOOL_IS_BOOL
    //62位iOS、tvOS、watchOS
    typedef bool BOOL;
#else
#   define OBJC_BOOL_IS_CHAR 1
    //32位iOS、macOS
    typedef signed char BOOL;
    // BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
    // even if -funsigned-char is used.
#endif

#define YES ((BOOL)1)
#define NO  ((BOOL)0)
image.png

sizeof(BOOL) = 1
sizeof(bool) = 1
sizeof(Boolean) = 1

你可能感兴趣的:(布尔)