• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating Dictionary Keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: How do get transparent text background ?
  • Next by Date: Re: How to include InternetConfig.h
  • Previous by thread: Re: How do get transparent text background ?
  • Next by thread: Re: How to include InternetConfig.h
  • Index(es):
    • Date
    • Thread