Definition of Nil and nil was: NSData testing for NULL [SOLVED]
Definition of Nil and nil was: NSData testing for NULL [SOLVED]
- Subject: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
- From: Mark Ritchie <email@hidden>
- Date: Mon, 17 Jan 2005 08:22:08 -0500
On Jan 17, 2005, at 2:16 AM, Robin Hermann wrote:
Can't find very much info (Apple Docs, Google) on NULL, Nil and nil
though.
nil and Nil are defined in the Objective-C runtime header (excerpt
below.)
As Uli pointed out, nil is typically used when you expect a pointer to
an instance of an object. Nil is typically used when you expect a
pointer to a class object.
The handy thing about nil is that you can legally send messages to nil
in Objective-C.
[nil someMethodName] is quite legal and in fact, relied upon regularly.
My incorrect use of null is a failing from having done too much work in
Java lately.
Hope that gives you some idea of nil and Nil.
Mark.
From: NSObjCRuntime.h
In /System/Library/Frameworks/Foundation.framework
...
#if !defined(nil)
#define nil (id)0
#endif
#if !defined(Nil)
#define Nil (Class)0
#endif
...
__
Mark Ritchie, email@hidden 416-843-5479
Software Developer, Apple Certified Developer Trainer
WebObjects, Cocoa, Mac OS X and Mac OS X Server
Diamond Lake Consulting Inc., Toronto, Ontario, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden