• 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
Why is NULL used sometimes when documentation specifies nil?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is NULL used sometimes when documentation specifies nil?


  • Subject: Why is NULL used sometimes when documentation specifies nil?
  • From: Jeremy French <email@hidden>
  • Date: Thu, 13 Jan 2005 10:32:11 -0500

What is the difference between nil and NULL?

Why does the Foundation Reference for NSScanner specify nil to skip search results, while the NSScanner example in "Strings" documentation uses NULL to omit results?

In particular, the reference for the NSScanner method "scanString:intoString:" says, "invoke this method with nil as stringValue to simply scan past a given string."

But the example (in "Strings" documentation 2004-06-28) use NULL, instead of nil, to skip sanned results?

<snippet from example>

while ([theScanner isAtEnd] == NO) {
  if ([theScanner scanString:PRODUCT intoString:NULL] &&
      [theScanner scanUpToCharactersFromSet:semicolonSet
               intoString:&productName] &&
      [theScanner scanString:@";" intoString:NULL] &&
      [theScanner scanString:COST intoString:NULL] &&
      [theScanner scanFloat:&productCost]) {
          // do something here
      } else return NO;
}

</snipper from example>

So why is NULL used sometimes when documentation specifies nil?

----

Details:

Reference says use nil for scanString:intoString:
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSScanner.html#//apple_ref/doc/uid/20000159/ scanString_intoString_>


Example in documentation uses NULL
<http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/ index.html>
_______________________________________________
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: Why is NULL used sometimes when documentation specifies nil?
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: [SOLVED] Re: waitForDataInBackgroundAndNotify blocking
  • Next by Date: Re: Why is NULL used sometimes when documentation specifies nil?
  • Previous by thread: Proxy User/Password *required* setting? Where is it?
  • Next by thread: Re: Why is NULL used sometimes when documentation specifies nil?
  • Index(es):
    • Date
    • Thread