• 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
Re: Why does the following refuse to compile?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Why does the following refuse to compile?
      • From: Andre <email@hidden>
References: 
 >Why does the following refuse to compile? (From: email@hidden)
 >Re: Why does the following refuse to compile? (From: Fritz Anderson <email@hidden>)
 >Re: Why does the following refuse to compile? (From: Andre <email@hidden>)

  • Prev by Date: Re: Why does the following refuse to compile?
  • Next by Date: Re: glitch upgrading from Xcode 2.0 to 2.4
  • Previous by thread: Re: Why does the following refuse to compile?
  • Next by thread: Re: Why does the following refuse to compile?
  • Index(es):
    • Date
    • Thread