[Tutor] scope/namespaces
Alan Gauld
alan.gauld at btinternet.com
Tue Apr 24 20:02:13 CEST 2007
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.
More information about the Tutor
mailing list