• 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
Re: Addressbook api
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressbook api


  • Subject: Re: Addressbook api
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 6 Sep 2002 16:52:01 +0200

On Friday, September 6, 2002, at 03:49 , Henri Lamiraux wrote:

2. You're saying that, in this case, NSDictionary's
dictionaryWithObjectsAndKeys class method requires two trailing nils?

I always been using two trailer nils. Maybe one is enough.

It is, definitely.

I need to try it. But two work fine.

Of course. Any number of them would work fine. Matter of factly, just *anything* after the first nil works fine, since -- due to the nil -- it is not used at all:

id d=[NSDictionary dictionaryWithObjectsAndKeys:obj,key,nil,whatever,nil,NULL,1,3.141592654,foobar,
(void*)main];

would still properly create a dictionary of one pair <key, obj> ;)

On Friday, September 6, 2002, at 04:04 , Bill Cheeseman wrote:

the processing stops before it sees the second trailing nil

Exactly, that's the reason.

(should be a NULL, I believe, at least according to the documentation).

No. These are _objects_, and therefore nil is what you want. NULLs are for pointers (you use it eg. in scanner methods, for things like NSString**).

But I imagine there is a
risk that a future change in the underlying implementation will cause
problems.

Unless the change is done by a complete madman who would intentionally break backward compatibility, the risk is non-existent.

The only reason to do this change would be to allow nils to be stored as values directly. Even if this happened -- which I *seriously* doubt -- there would have to be a new API for that anyway (so as a non-stored key and a key with a nil value are distinguished).
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Addressbook api
      • From: Andreas Monitzer <email@hidden>
    • Re: Addressbook api
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Addressbook api (From: Henri Lamiraux <email@hidden>)

  • Prev by Date: Get parent process (Carbon question)
  • Next by Date: Re: Get parent process (Carbon question)
  • Previous by thread: Re: Addressbook api
  • Next by thread: Re: Addressbook api
  • Index(es):
    • Date
    • Thread