[Tutor] scope/namespaces

Ben Sherman bensherman at gmail.com
Tue Apr 24 20:14:18 CEST 2007

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 <alan.gauld at btinternet.com> wrote:
> Correcting my own post!
> "Alan Gauld" <alan.gauld at btinternet.com> 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  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list