Is there any difference between bool, Boolean, and BOOL in Objective-C?

前端 未结 3 2049
栀梦
栀梦 2020-12-28 13:00

I know BOOL is actually a typedef of signed char, but what about Boolean?

What is the difference between bool, Boolean and BOOL?

3条回答
  •  感动是毒
    2020-12-28 13:47

    If your new APIs have no need to interact with old ones, bool is more specific and clear than BOOL.

    When building an non-Mac application with Xcode 9, BOOL v = 2; NSLog(@"%d", v); outputs "1", not "2".

    Reference to Apple documentation

提交回复
热议问题