开发者

BOOL vs Boolean

What is the difference betwe开发者_如何学Pythonen BOOL and Boolean in Objective C ?

Does it matter which one is used?

If not, why do they both exist?

Thanks


There's no functional difference1 between Objective-C's BOOL data type and the various flavors of boolean types provided by, e.g., stdbool.h for C. However, idiomatic Objective-C code uses the BOOL type (and the values YES and NO) for boolean values.

1. There are some differences. For example, a BOOL is actually a signed char, whereas (on my machine) stdbool.h defines _Bool_ and bool to be an int.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜