Well, for a _pointer_ type*, there is an "empty" value: NULL. (For
object pointers the constant 'nil' is used, but they both have the
same underlying value.)
When an Objective-C object is created, its storage is filled with
zeroes. So instance variables that you haven't assigned a value to yet
are guaranteed to be NULL, or nil, or zero. (In other words, Objective-
C's 'alloc' calls 'calloc', not 'malloc'.)
But watch out — this doesn't apply to local variables in functions or
methods. Those have random/garbage values until initialized. Same goes
for raw memory allocated via 'malloc' — use 'calloc' if you want it
zeroed.
—Jens
* It sounds like you're coming from a PHP background ... if you
haven't done much C programming before, the distinction between
pointers and scalars is likely to be confusing, since it doesn't exist
in higher-level languages. If so, definitely find a good C textbook
and read through that first!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden