I’m temped to use an int, and make 0 == NO, 1 == YES, and anything else == undefined.
Obviously there are a million ways to do something like this, but what seems like the best way to you? Concerns I can think of include simplicity and memory footprint (e.g. what if I have a lot of these?).
Another way is to use two BOOLs, one for isDefined, and one for value
Another way,
typedef enum { CPStatusUndefined, CPStatusAvailable, CPStatusUnavailable } CPStatus;
Edit, the use case is:
I have a yes/no property that is difficult to calculate. When it is being checked, it is checked frequently (by UIMenuController, OFTEN), but unless the user selects it, it is never checked. The way I chose to deal with this is a tri-type variable. The first time you check, if it is undefined you calculate the yes/no value and return it, after that you just return the yes/no value.
Use an enum. In Objective-C they work just like they do in C/C++