Re: defined but not used error
Re: defined but not used error
- Subject: Re: defined but not used error
- From: Jens Alfke <email@hidden>
- Date: Mon, 26 May 2008 09:22:48 -0700
On 26 May '08, at 9:09 AM, John Love wrote:
I want the
StatusController.h file to list the various possible messages; e.g.,
static NSString *openMsg = @"Open a new Spreadsheet";
...
However, the Cocoa compiler will present me with Warning: whatever
defined
but not used.
By declaring them in the .h file, you get copies of them in every file
that includes it. Probably not what you wanted.
What probably makes the most sense is to move the declarations into
StatusController.m, since you're probably only using the strings from
within that class.
If you need the strings to be available from a header, do it like this:
// in StatusController.h:
extern NSString* openMsg const;
// in StatusController.m:
NSString *openMsg const = @"Open a new Spreadsheet";
(The 'const' declaration is so that you can't accidentally assign a
new value to openMsg.)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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