Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!decuac!nntpd.lkg.dec.com!telfon.enet.dec.com!mailman From: mailman@telfon.enet.dec.com (Steven M. Mailman) Newsgroups: comp.lang.pascal Subject: Re: Pascal Puzzle: what is a standard compiler Message-ID: <23941@shlump.lkg.dec.com> Date: 28 Jun 91 14:57:30 GMT Sender: newsdaemon@shlump.lkg.dec.com Organization: Digital Equipment Corporation Lines: 30 In article <2581@cybaswan.UUCP>, cslaurie@cybaswan.UUCP (Laurie Moseley ) writes... >This puzzle seems to depend heavily upon non-standard compiler vagaries. > >Firstly, I am having some difficulty in thinking up situations in >which I would wish to write: > > for y := 1 to y do > >Secondly one is also relying on the compiler to pick up the value of the loop >termination variable (the second y) and storing it separately from >the loop control variable (even though they should be identical - they >have the same identifier and are within the same scope). It *is* depending on the compiler to pick up value and store it in a temporary variable. The Pascal standard specifies that a compiler MUST do this (or behave asif it saved value). Also, it *is* undefined after the loop is done. It may have the value 10 but it is still undefined, i.e. you should not depend on it being 10. With some compilers the value may be 11. The Pascal standard says that it is illegal to even look at that value. ------ Steve Mailman Digital Equipment Corporation mailman@tle.enet.dec.com Disclaimer: The opinions and statements expressed by me are not necessarily those of Digital Equipment Corporation.