Maurice Lombardi wrote:
Frank Heckenbach a écrit :
This would mean that the loop variable could practically not be used outside of the for loop. If this is really true, I'd really favour a syntax that makes this clear (like `for i : Integer = 1 to 10 do ...'), so i has only the corresponding scope.
In fact this very syntax was used in one of the intermediate Wirth languages between algol and pascal (we used at Grenoble an algolW compiler implementing it at that time). It was done so exactly to forbid any use of the for control variable outside of the loop, because in many CPU for control variables are maintained in registers (CX in 16 bit 386 CPU for example) and need not at any time to be affected into memory (at least the for control variable of the innermost loop). So a good idea was lost in going into EP. But who may update the standard ?
The commitees... ;-)
But we could perhaps implement it in GPC (like we've already implemented a lot of other non-standard extensions)...
Frank