Mail Archives: djgpp/1999/02/14/15:30:32
I don't know why this happens, but I do have to say that I do that kind
of thing often (in C++ mind you). Q, do you have optimizations on?? That
_might_ to it.
(Certain loop optimizations are somewhat untested, such as
loop-unrolling)
Also, in this case (though w/ gcc it may be somewhat irrelevant) you
could write it as:
for(int x=0;x<=10;x++) printf("%i\n,x).
This makes x local to the loop, and unusable(out of scope) anywhere
else.
Carl Marg wrote:
> I'm using DJGPP, and I've noticed that it will not allow me to
> declare variable in the middle of code, i.e
>
> int x,y;
> for (x=0;x<=10;x++) printf("%i\n",x);
> for (y=0;y<=10;y++) printf("%i\n",y);
>
> the code above would work, while below it would give me a parse error
>
> int x;
> for (x=0;x<=10;x++) printf("%i\n",x);
> int y;
> for (y=0;y<=10;y++) printf("%i\n",y);
>
> what I'm wondering is this just a part of standard C,
> is there some option that will change this?
>
> Carl Marg
- Raw text -