You can't declare a variable as holding an object itself; you can only declare it as holding a pointer to an object. BOOL
s aren't objects, so it's fine to have a variable containing a BOOL
instead of a pointer to one. The same goes for numeric types, structures such as NSRange
and NSRect
, etc.—anything that isn't an instance of an Objective-C class.
I'm not sure why NeXT/Apple added this restriction. If I remember correctly, it only exists in Apple's version of GCC; the GNUstep version does not have it. That is, the GNUstep version allows you to declare a variable holding an object (NSString myString
). Having never used GNUstep myself, I don't know how useful such variables really are in practice.