Am I wrong in my memory? When I was a wee lad prior to 99 for sure),
I thought I would initialize my loops with:
for (int x=0; x <10; x++) {
}
I am rapidly veering off topic.
On 4/24/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
> Correcting my own post!
>
> "Alan Gauld" <[EMAIL PROTECTED]> wrote
>
> > That's a very recent change to C/C++ (1999 apparently),
>
> Actually only a recent change in C. Its always been true of C++.
> But in C up until recently(*) you couldn't define a loop
> variable in the loop it had to be outside:
>
> int x;
> for (x=0;....)
>
> (*)I'm not sure whether the C++ style loop definition was
> introduced in the original ANSI standard or the later
> revision (none of my books malke it clear), but I think it was
> the revision.
>
> But C++ always had loop variables as part of block scope.
>
> Sory for any confusion,
>
> Alan G.
>
>
>
> _______________________________________________
> Tutor maillist - [email protected]
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor