Malloc
Malloc

Reputation: 16296

(null) and <null>, what differences between?

When i try to display the value of a Dictionary value:

NSLog(@"%@",[self.user valueForKeyPath:@"age"]);

The first time, i got (null), the second time i got <null>

What differences does exist between the two result? Thanx in advance.

Upvotes: 3

Views: 120

Answers (1)

Richard J. Ross III
Richard J. Ross III

Reputation: 55583

When NSLog outputs (null), it means that it was literally passed in 0x0, or NULL.

When it outputs <null>, it means that it was passed in [NSNull null], instead.

NSNull's are commonly used in arrays & other collections that cannot store nil by default. Thus, a special object is used instead.

Upvotes: 10

Related Questions