开发者

BOOL vs Boolean

开发者 https://www.devze.com 2023-02-03 18:20 出处:网络
What is the difference betwe开发者_如何学Pythonen BOOL and Boolean in Objective C ? Does it matter which one is used?

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

精彩评论

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