Re: Global Variables
Re: Global Variables
- Subject: Re: Global Variables
- From: Charilaos Skiadas <email@hidden>
- Date: Mon, 21 Mar 2005 23:24:46 -0600
On Mar 21, 2005, at 11:06 PM, Johnny Deadman wrote:
Alternatively, if it isn't something the user should be able to
change, you can declare it as 'extern' as Rakka describes, which is
what Apple do for their constant strings and so on.
I find it convenient to hard-code all strings I use as keys to
dictionaries as #define's. Helps a lot with debugging. If you mistype a
string, you get a compile error, instead of a nil object that would be
too hard to track down.
In my prefix.pch file, I put stuff like:
#define CHSProgramName @"ProgramName"
#define CHSProgramCode @"ProgramCode"
#define CHSExtensionName @"ExtensionName"
#define CHSPath @"Path"
#define CHSArguments @"Arguments"
#define CHSChecked @"Enabled"
#define CHSInputPrompt @"InputPrompt"
#define CHSManuallyAddInput @"ManuallyAddInput"
And then use the CHS.. instead of the strings. Works like a charm.
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden