Type Alias

BOOL

Type to represent a Boolean value.

Declaration

iOS, tvOS, watchOS
typedef bool BOOL;
macOS, Mac Catalyst
typedef signed char BOOL;

Discussion

BOOL is explicitly signed so @encode(BOOL) is c rather than C even if -funsigned-char is used.

For values, see Boolean Values.

Special Considerations

Since the type of BOOL is actually char, it does not behave in the same way as a C _Bool value or a C++ bool value. For example, the conditional in the following code will be false on i386 (and true on PPC):

- (BOOL)value {
    return 256;
}
// then
if ([self value]) doStuff();

By contrast, the conditional in the following code will be true on all platforms (even where sizeof(bool) == 1):

- (bool)value {
    return 256;
}
// then
if ([self value]) doStuff();