Re: Why does the following refuse to compile?
Re: Why does the following refuse to compile?
- Subject: Re: Why does the following refuse to compile?
- From: Eric Albert <email@hidden>
- Date: Sun, 24 Sep 2006 11:45:08 -0700
On Sep 24, 2006, at 11:27 AM, Andre wrote:
On 2006/09/24, at 10:56, Fritz Anderson wrote:
On Sep 24, 2006, at 12:31 PM, email@hidden wrote:
NSMutableArray* array = [NSMutableArray array];
const NSStringEncoding* encoding = [NSString
availableStringEncodings];
while (*encoding)
{
NSDictionary *encoding = [NSDictionary
dictionaryWithObjectsAndKeys:[NSString
localizedNameOfStringEncoding:*encoding],@"encodingName",
[NSNumber numberWithInt:*encoding],@"encoding",nil];
[array addObject:encoding];
encoding++;
}
At the line after "while (*encoding)" I get the following errors:
incompatible type for argument 1 of ‘localizedNameOfStringEncoding:
incompatible type for argument 1 of ‘numberWithInt:
Call me paranoid but your masking redefinition of "encoding" from
NSStringEncoding * to NSDictionary * makes me very suspicious.
Yes, that was it. I actually just saw that.
No emoticon can convey the embarrassment....
If you check the "Hidden Local Variables" box in your target
settings, you'll get a warning for this:
/Users/ejalbert/Desktop/Test/Test.m:11: warning: declaration of
'encoding' shadows a previous local
/Users/ejalbert/Desktop/Test/Test.m:7: warning: shadowed declaration
is here
Shadowing another variable is legal, but I've found that it's more
often unintentional than not.
Hope this helps,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden