What is the best bet between:
#define kYes @"Yes"
AND
static NSString *const kYes = @"Yes";
And
NSString *kYes = @"Yes";
from memory consumption point of view. Keeping in mind that there will be thousands of constants in the application.
From the memory stand point - static variable is better, since it's referenced once. The #define will insert the string into all the occurrences, by that - multiplying the memory usage... (that is unless GCC optimizing same constant string occurrences, which it actually might. in that case - there is no difference)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With