Re: For loop shenanigans.
Re: For loop shenanigans.
- Subject: Re: For loop shenanigans.
- From: Richard Clark <email@hidden>
- Date: Fri, 5 Dec 2003 08:19:28 -0800
Run this code:
#include <stdio.h>
int main (int argc, const char * argv[]) {
int i;
for (i = 0; i < 9; i += 3) {
if (i > 0) printf(", ");
printf("%d", i);
}
return 0;
}
and note that it prints "0, 3, 6" as it should. You'll need to look
elsewhere in your code for the problem (and note that a compiler bug is
a bug of last resort; in 20 years of programming I've found only one
honest compiler bug and that was an odd cross-TOC calling bug when
Apple's PowerPC systems were still in Alpha testing and they were
extensively modifying the compiler.)
...Richard
On Dec 5, 2003, at 12:41 AM, Matt Gough wrote:
>>> for(i = 0; i < 9; i += 3);
>>> {
>>> ... blah...
>>> }
>>>
>>> i is equal to 3 on entry to the loop, which it shouldn't be.
>>>
>>> Bug in Xcode, or GCC?
>>
>> Short between seat and keyboard? Note semicolon after the 'for'
>> statement
>
> Ignoring the fact that the code is probably not as intended, surely i
> should
> be 9 by the time it gets to ...blah... instead of 3.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.