[fpc-pascal] Can variables be declared within a block?
Andreas Berger
Andreas at TheBergerClan.org
Tue Oct 19 01:33:17 CEST 2010
>> But it should make you wonder why this is no longer allowed in the
>> latest C++ standards.
> What do you mean?
>
> The current C++ standard (ISO 1998+TR1) permits short scope
> declarations. Indeed, C++ permits declarations to appear anywhere, not
> just after a { to open a function or compound statement. It has done
> since the A.R.M. days, and in some implementations before that.
You are correct. Been a while since I programmed in C++. The new
standard enforces that the short scope variable declared in a for loop
goes out of scope at the end of the loop. Older implementations did not
always enforce this. My bad.
More information about the fpc-pascal
mailing list