On Feb 22, 2009, at 5:16 PM, Christiaan Hofman wrote:

The DictionaryExample.c in /Developer/Examples/CoreFoundation shows
how to use a CFDictionary for integers.  If you want to make it 64
bit clean, use long/uintptr_t/intptr_t instead of int.  For integer
arrays or sets, STL is probably a better choice...


The CFDictionary code is very old, and in view of the 64 bit docs
wrong, so that's not a relevant reference, IMHO.

Can you be more specific? I use the technique pretty frequently, so I'd definitely like to know if it's going to break on me! The 64 bit transition guide says to avoid casting pointers to non-pointer types, but that's a different problem.

Using things like
intptr etc generally I consider hackish, you always have to be very
careful with sizes. This method is always valid, and is really the way
CF collections are designed.

Yeah, you have to be careful with sizes, but sizeof(void *) == sizeof (uintptr_t) == sizeof(long). Since CF collections are required to work correctly with pointer sizes, I think it will always be valid to use an equivalent-sized value...unless I miss something. If you use malloc, you might as well use an NSNumber and avoid all the CF stuff, since you're taking the performance hit anyway.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Bibdesk-develop mailing list
Bibdesk-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to