• 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: variable problem is driving me nuts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable problem is driving me nuts


  • Subject: Re: variable problem is driving me nuts
  • From: Roland King <email@hidden>
  • Date: Sun, 28 Oct 2012 20:15:57 +0800

On 28 Oct, 2012, at 8:01 PM, H Miersch <email@hidden> wrote:

> then why does Xcode complain about an unused result? this is just another example of a TOTALLY USELESS error message.
>
> anyway, i fixed it, and now it works. thanks.
>
> On 28. Oct 2012, at 11:56, Roland King <email@hidden> wrote:
>
>>
>> On 28 Oct, 2012, at 7:50 PM, H Miersch <email@hidden> wrote:
>>
>>> ok, it looks like i've sorted the original problem. but here's the next one:
>>>
>>> i have this line:
>>>
>>> for (i = 0; i++; i < count) {…}
>>>
>>> in the app delegate. Xcode keeps giving me this warning: expression result unused. WTF? that is correct syntax for a for loop, isn't it? so then why do i keep getting this warning?
>>> also, i have confirmed that the statements between { and } are NOT executed, no matter what. that's not right either. so WTF is going on here?
>>> _______________________________________________
>>
>>
>> no it's not even vaguely the right syntax for a for loop. You have
>>
>> 	for( initialiser, iterator, condition )
>>
>> it's supposed to be
>>
>> 	for( initialiser, condition, iterator )
>>
>> that's just basic C
>>
>> so change it to
>>
>> 	for( i = 0 ; i < count ; i++)
>>
>> Xcode is totally correct here.
>

because you are not using the result of i < count which was a hint that you had made a mistake. So no that is not another TOTALLY USELESS error message, it's actually a pretty good error message from the compiler which has no idea what you've done but knows you have evaluated something and then not used the answer. In the end it got you to ask the question "that is correct syntax for a loop isn't it?" and it wasn't so I think you might cut the compiler a bit of slack here.
_______________________________________________

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


References: 
 >variable problem is driving me nuts (From: H Miersch <email@hidden>)
 >Re: variable problem is driving me nuts (From: H Miersch <email@hidden>)
 >Re: variable problem is driving me nuts (From: Roland King <email@hidden>)
 >Re: variable problem is driving me nuts (From: H Miersch <email@hidden>)

  • Prev by Date: Re: variable problem is driving me nuts
  • Next by Date: Re: variable problem is driving me nuts
  • Previous by thread: Re: variable problem is driving me nuts
  • Next by thread: Re: variable problem is driving me nuts
  • Index(es):
    • Date
    • Thread