Re: Global variable for whole application.
Re: Global variable for whole application.
- Subject: Re: Global variable for whole application.
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 18 Apr 2007 08:02:30 -0700
On 4/18/07, Filipe Varela <email@hidden> wrote:
no matter what you're trying to do, that's a very very bad design.
you can't possibly need an application-wide global variable. use
classes, accessors, notifications, delegation, etc
Global _constants_ are common and reasonable to do... just look at the
Cocoa.framework for countless examples.
For example I do things like the following in my code all the time
In .h file...
// Participant database notification name constants
extern NSString* const kParticipantDB_ParticipantJoined;
extern NSString* const kParticipantDB_ParticipantLeft;
...
In .m / .mm file...
NSString* const kParticipantDB_ParticipantJoined = @"Participant_Joined";
NSString* const kParticipantDB_ParticipantLeft = @"Participant_Left";
...
Use of #defines for constants has its uses but it also has it limits
and weaknesses. I personally wouldn't recommend their use with any
type of generic statement.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden