Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: CFPreferencesSetValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFPreferencesSetValue



On 5/31/04 2:10 PM, David Duncan didst favor us with:

> On May 31, 2004, at 12:27 PM, Laurence Harris wrote:
>
>> Absolutely. I really want to know how you got this to compile.
>>
>> The address of a long is not a CFPropertyListRef, so CFPreferencesSetValue
>> (cstr, &j,...) shouldn't even compile. To store a long, you need to convert
>> it to a CFNumberRef:
>
> Well, the deficiency comes from the way that CFPropertyListRef is
> defined and depending on your POV in the C language. It is defined as a
> CFTypeRef, which in turn is defined as a void*, and C allows you to
> convert a pointer (or integer) of any kind into a void*. Thus the label
> of CFPropertyListRef is not much more than documentation, as the
> language will let you pass nearly anything for it.

Interesting. I tested that line in my application and it wouldn't compile.

In any case, the fact that CFPreferencesSetValue() is declared as taking a
CFPropertyListRef should be a big clue that long* won't work. longs have
values, but so do chars, short, long longs, doubles, blah blah blah. It just
doesn't make sense to pass a long* in this situation. That's making an
assumption of gigantic proportions, and even assumptions more reasonable
than this tend to be evil. ;-)

Larry
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: CFPreferencesSetValue (From: David Duncan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.