I can't chance upon the right incantation for using both an existing
variable and an inline new one in a for loop. I've boiled this down to
a trivial show case, same results for both gcc 4.0.1 and 4.2.1:
int i;
. . .
for (i=0, int m=0; i<5; i++) { . . . };
printf("Final value of i: %d\n",i);
error: syntax error before ‘int’
error: syntax error before ‘)’ token
So I tried this:
int i;
. . .
for (int m=0,i=0; i<5; i++) { . . . };
printf("Final value of i: %d\n",i);
error: redefinition of ‘i’
Is there a rule that ALL initialized loop variables are either new and
local to the loop, or that none are? Surely Im doing something wrong
here!
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com