On Thu, Nov 12, 2009 at 11:50 AM, David Ross wrote:
> Jonathon,
>
> GCC does not like declaring variables in a for statement.
It likes it just fine. You just need to build as C99 (or GNU99).
--
Clark S. Cox III
clarkc...@gmail.com
___
Cocoa-dev maili
On 12 Nov 2009, at 11:50, David Ross wrote:
> GCC does not like declaring variables in a for statement.
Adding -std=c99 or -std=gnu99 to the compiler flags will fix that.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin r
Jonathon,
GCC does not like declaring variables in a for statement. If you want to make
the variable m have the scope for only the for loop, you would need:
foo()
{
...
{
int i, m;
for (i=0, m=0; i<5; i++){...}
printf("Final value o
On Nov 12, 2009, at 12:14 PM, Greg Parker wrote:
On Nov 12, 2009, at 11:29 AM, Jonathon Kuo wrote:
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
On Nov 12, 2009, at 11:29 AM, Jonathon Kuo wrote:
> 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, i
I believe this is actually independent of being in a for loop. Your first
line corresponds to code like this:
int i;
i=0, int m=0;
Which is syntactically incorrect.
Your second example corresponds to this:
int i;
int m=0, i;
Which is an attempt to re-declare i.
So you're correct; you can't h
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: %