• 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
Obj-C difference between NULL and nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Obj-C difference between NULL and nil


  • Subject: Obj-C difference between NULL and nil
  • From: Chris Lemler <email@hidden>
  • Date: Sat, 26 May 2001 09:33:00 -0700

I have been reading thru the code for various Obj-C programs, and I have seen some people consistently use NULL, and others use nil:

NSMutableArray *myArray;

myArray = NULL;

or

myArray = nil;

Are there any real advantages to using one over the other? Does it make any difference when releasing an object that was never allocated:

myArray = NULL;
[myArray release];

versus

myArray = nil;
[myArray release];

Thanks for any tips,
Chris


  • Follow-Ups:
    • Re: Obj-C difference between NULL and nil
      • From: Brian Hill <email@hidden>
  • Prev by Date: Re: Why Objective-C over Java?
  • Next by Date: Re: Why Objective-C over Java?
  • Previous by thread: Re: Why Objective-C over Java?
  • Next by thread: Re: Obj-C difference between NULL and nil
  • Index(es):
    • Date
    • Thread