Re: how to check if a property is empty?
Re: how to check if a property is empty?
- Subject: Re: how to check if a property is empty?
- From: Davide Benini <email@hidden>
- Date: Sat, 29 Mar 2008 18:11:47 +0100
There's no intrinsic "initialized but empty" state of Objective C
objects. 'variantEnding' can be initialized to nil (or, rather,
allowed to remain nil, since
everything in a new object is guaranteed to be zeroes) or it can be
given a NSNumber value.
I half suspected something like this...
If you really *need* an 'empty' state, you can choose to regard nil
as 'empty' if it suits your purposes -- that's often how it's done
-- or you can choose use a specific value to mean 'empty' (e.g.
[NSNumber numberWithInteger:NSNotFound] might be a possibility).
Thanks, this is exactoly what I was looking for.
By the way, '[[NSNumber alloc] init]' is not likely to be a useful
way to initialize a NSNumber instance variable. The NSNumber object
*has* a value, even if you don't care what the value is at that
point, so you may as well be explicit.
Could you please expand on this? What is the value of a NSNumber
initialized with a simple init? 0 ?
Cheers,
Davide
_______________________________________________
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:
This email sent to email@hidden