Creating Dictionary Keys
Creating Dictionary Keys
- Subject: Creating Dictionary Keys
- From: Phill Kelley <email@hidden>
- Date: Tue, 1 Jun 2004 00:13:14 +1000
Hi!
I usually declare things like dictionary keys using the C preprocessor's
#define mechanism but I've noticed that other people seem to prefer global
variables (eg "extern NSString" in a .h file with a constant assignment in
the .m file).
To me, the #define mechanism seems simpler, both to implement and maintain,
because it keeps everything in one place, albeit at the expense of having
multiple copies of the string floating around in memory if the string is
referenced in more than one class.
Is the reason why so many Cocoa programmers prefer the global-variable
approach simply to guarantee that there is only a single copy of each
string in memory, or is there more to it than that?
Regards & thanks, Phill
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.