• 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: CFMutableDictionary Capacity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFMutableDictionary Capacity


  • Subject: Re: CFMutableDictionary Capacity
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 21 Jul 2011 01:52:26 +0200

Le 21 juil. 2011 à 01:48, Jean-Daniel Dupas a écrit :

>
> Le 21 juil. 2011 à 00:30, Jens Alfke a écrit :
>
>>
>> On Jul 20, 2011, at 2:34 PM, Andreas Grosam wrote:
>>
>>> According the doc, the parameter "capacity" in function CFDictionaryCreateMutable() sets the *maximum number* of key-value pairs which can be inserted into the container. That is, it's not an *initial* capacity.
>>
>> I think that was a mistake in the docs. The comment in CFDictionary.h in the 10.7 SDK says:
>>
>>       @param capacity A hint about the number of values that will be held
>>               by the CFDictionary. Pass 0 for no hint. The implementation may
>>               ignore this hint, or may use it to optimize various
>>               operations. A dictionary's actual capacity is only limited by
>>               address space and available memory constraints). If this
>>               parameter is negative, the behavior is undefined.
>>
>> Since CFDictionary and NSDictionary have the same implementation under the hood, I think the capacity will have the same effect at runtime whichever API you use.
>
>
> IIRC, the semantic of the capacity parameter changed in 10.5. Before 10.5, it specified the max capacity and trying to insert more elements was documented as an undefined behavior.

Just for the record, my previous comment is about the CoreFoundation API only. The Foundation API has always defined the capacity parameter as a hint.

-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >CFMutableDictionary Capacity (From: Andreas Grosam <email@hidden>)
 >Re: CFMutableDictionary Capacity (From: Jens Alfke <email@hidden>)
 >Re: CFMutableDictionary Capacity (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: CFMutableDictionary Capacity
  • Next by Date: Re: Smooth resizing of a text field
  • Previous by thread: Re: CFMutableDictionary Capacity
  • Next by thread: Re: CFMutableDictionary Capacity
  • Index(es):
    • Date
    • Thread