Skip navigation.
 
mlRe: how to check if a property is empty?
FROM : Davide Benini
DATE : Sat Mar 29 18:11:47 2008

>
> 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

Related mailsAuthorDate
mlhow to check if a property is empty? Davide Benini Mar 29, 16:32
mlRe: how to check if a property is empty? Quincey Morris Mar 29, 18:04
mlRe: how to check if a property is empty? Davide Benini Mar 29, 18:11
mlRe: how to check if a property is empty? Jens Alfke Mar 29, 18:16
mlRe: how to check if a property is empty? Jens Alfke Mar 29, 18:22