Xref: utzoo comp.lang.misc:1429 comp.lang.pascal:803 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!pyramid!weitek!rober From: rober@weitek.UUCP (Don Rober) Newsgroups: comp.lang.misc,comp.lang.pascal Subject: Re: Loops Message-ID: <9158@weitek.UUCP> Date: 13 Apr 88 05:34:16 GMT References: <2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <294@tmsoft.UUCP> <11047@shemp.CS.UCLA.EDU> Reply-To: rober@weitek.UUCP (Don Rober) Organization: WEITEK Corp. Sunnyvale Ca. Lines: 20 In article <11047@shemp.CS.UCLA.EDU> gast@lanai.UUCP (David Gast) writes: > >While it is commonly believed that it is impossible to change the >index variable in a for loop, it is possible to do so. Consider the >following program. > [illegal program with threatening for loop reference deleted] While it is a pain, it it not really that difficult to enforce this area of the Pascal standard. When an assignment to a variable is made, the symbol table is marked noting a potentially threatening reference. When the for-loop is seen, the variable is checked to see if a threatening reference happened; if so, an error. (Appropriate care must be taken for threatening references that *follow* the for-loop.) The Unisys A-series compiler does this checking. It was interesting to see the number of otherwise "portable" programs that would fail with a standard-enforcing compiler.-- ---------------------------------------------------------------------------- Don Rober UUCP: {pyramid, cae780}!weitek!rober Weitek Corporation 1060 East Arques Sunnyvale, CA 94086