• 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: More NSDictionary to CFDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More NSDictionary to CFDictionary


  • Subject: Re: More NSDictionary to CFDictionary
  • From: leenoori <email@hidden>
  • Date: Fri, 17 Nov 2006 17:12:48 +0100

El 17/11/2006, a las 16:21, Adam R. Maxwell escribió:

On Nov 17, 2006, at 00:16, Matt Gough wrote:


On 16 Nov 2006, at 23:31, Adam R. Maxwell wrote:

One thing to be careful of with CF functions is that many of them don't accept nil as a parameter, and CFDictionaryContainsKey (self, aKey) will crash if aKey is nil (at least for a dictionary instantiated via NSDictionary methods) whereas objectForKey: will just return nil. So you may also want to NSParameterAssert(aKey ! = nil) or return (nil == key ? NO : CFDictionaryContainsKey ( self, aKey)) if using CF directly.


But in his case, self cannot be nil as if it were hasKey wouldn't even have been called. But in general, yes avoid passing nil to CF routines.

Heh, so much for my hastily written advice :). Thanks for pointing that out!

Hastily written? I think your advice was correct. You said that *aKey* might be nil and that might cause a crash (correct); Matt then replied saying, *self* can't be nil (also correct, but he was "correcting" something you'd never said).


The code should check for nil keys prior to calling CFDictionaryContainsKey(), as you originally suggested.


_______________________________________________ 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
References: 
 >More NSDictionary to CFDictionary (From: Kevin Bracey <email@hidden>)
 >Re: More NSDictionary to CFDictionary (From: "Shawn Erickson" <email@hidden>)
 >Re: More NSDictionary to CFDictionary (From: "Adam R. Maxwell" <email@hidden>)
 >Re: More NSDictionary to CFDictionary (From: Matt Gough <email@hidden>)
 >Re: More NSDictionary to CFDictionary (From: "Adam R. Maxwell" <email@hidden>)

  • Prev by Date: Re: Filtering files in NSOpenPanel that NSAppleScript can run
  • Next by Date: Re: Filtering files in NSOpenPanel that NSAppleScript can run
  • Previous by thread: Re: More NSDictionary to CFDictionary
  • Next by thread: Core Recipes Sample Core Data Program
  • Index(es):
    • Date
    • Thread