• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Definition of Nil and nil was: NSData testing for NULL [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
      • From: Guy English <email@hidden>
    • Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
      • From: Robin Hermann <email@hidden>
References: 
 >NSData testing for NULL (From: Robin Hermann <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Robin Hermann <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Mark Ritchie <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: "M. Uli Kusterer" <email@hidden>)
 >Re: NSData testing for NULL [SOLVED] (From: Robin Hermann <email@hidden>)

  • Prev by Date: Re: NSData testing for NULL [SOLVED]
  • Next by Date: Having NSSecureTextField display the hidden text
  • Previous by thread: Re: NSData testing for NULL [SOLVED]
  • Next by thread: Re: Definition of Nil and nil was: NSData testing for NULL [SOLVED]
  • Index(es):
    • Date
    • Thread