Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: const vs. static CFStringRefs



CFSTR is just a macro. It's not incredibly magic. It just calls a private CF function. The macro body uses a trick to prevent the programmer from passing in anything other than a regular quoted string. (Probably the CF function fails somehow if you pass in a string that could potentially disappear.) As Larry would suggest, read the headers and it's all right there. :)

Neither version will behave significantly differently at runtime. Don't sweat it.


On Nov 30, 2005, at 2:18 PM, Stevo Brock wrote:

I guess I was asking more along the lines of memory allocation in the compiled file.  I should have stated my question differently.  I'm guessing the "static" version is a single memory allocation that can be referenced multiple times.  Does the "const" version end up being the same, or is it perhaps allocated every time it's referenced?  This all gets confusing in my head as I know that CFSTR is doing some behind-the-scenes stuff and I don't know what that is.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >const vs. static CFStringRefs (From: Stevo Brock <email@hidden>)
 >Re: const vs. static CFStringRefs (From: John Stiles <email@hidden>)
 >Re: const vs. static CFStringRefs (From: Stevo Brock <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.