J
Jonathan Clements
Hi all,
Does 'for' have it's own scope? In one compiler I'm quite happy
writing:-
for(unsigned long i=1; i <= WHATEVER; i++) { /* something here */ } and
then (not nested)
for(unsigned long i=1; i <= WHATEVER2; i++) { /* something here2 */ }
Probably bad practice, but as far as I understand C++, 'i' should be a
temp within the scope of the for loop. Some compilers allow this, others
don't.... I'm wondering if I'm mis-understanding the scope rules or the
compilers are.
Thanks,
Jon.
Does 'for' have it's own scope? In one compiler I'm quite happy
writing:-
for(unsigned long i=1; i <= WHATEVER; i++) { /* something here */ } and
then (not nested)
for(unsigned long i=1; i <= WHATEVER2; i++) { /* something here2 */ }
Probably bad practice, but as far as I understand C++, 'i' should be a
temp within the scope of the for loop. Some compilers allow this, others
don't.... I'm wondering if I'm mis-understanding the scope rules or the
compilers are.
Thanks,
Jon.