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
.
精彩评论