Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BOOL vs Boolean

Tags:

objective-c

What is the difference between BOOL and Boolean in Objective C ?

Does it matter which one is used?

If not, why do they both exist?

Thanks

like image 770
some_id Avatar asked Jan 12 '11 22:01

some_id


People also ask

Is it Boolean or bool in C#?

So the answer is both are one and the same and both can be used. But it is recommended to use the bool as that is the alias for the class System. Boolean. In other words the Boolean represents the System.

What is the difference between bool and Boolean in C++?

In C++ boolean is actually an integer. However, a bool in C# is a data type that cannot be casted to any other primitive type. In the field of computers and electronics, Boolean refers to a data type that has two possible values representing the true and false.

Is Java bool or Boolean?

For this, Java has a boolean data type, which can store true or false values.

Is bool a value type?

The bool type keyword is an alias for the . NET System. Boolean structure type that represents a Boolean value, which can be either true or false . To perform logical operations with values of the bool type, use Boolean logical operators.


1 Answers

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.

like image 135
mipadi Avatar answered Sep 18 '22 17:09

mipadi