Path: utzoo!attcan!uunet!lll-winken!lll-ncis!oodis01!uplherc!wicat!meph!gsarff From: gsarff@meph.UUCP (Gary Sarff) Newsgroups: comp.lang.pascal Subject: Re: Control variables in FOR loops Message-ID: <00056@meph.UUCP> Date: 19 Dec 88 16:09:30 GMT Organization: WICAT Systems Inc. Orem, Utah (Engineering-R & D) Lines: 20 In article <4267@okstate.UUCP> garnett@a.cs.okstate.edu (John Garnett) >From article <1440@csuna.UUCP>, by abcscnuk@csuna.UUCP (Naoto Kimura): >> I have only found one compiler that handles the program I >> gave in my previous message correctly. It is the pascal >> compiler (vers 4) found on the CDC Cyber 750 here at CSUN. >> The compiler should give the error message "Control variable >> must be local." >> > >Isn't it also true that the value of 'i' will be undefined following the >termination of the loop contained in procedure 'barf'? If this is the >case, then the loop contained in 'ack' should bomb after the first call >to 'barf' (assuming the global variable 'i' is allowed as a lcv) Depends on how the compiler makes 'i' undefined, if there is some way to put a NaN (not a number) in i for example. For the record my compiler Pascal 4.4 on Wicat Systems computers (68020 based) also gives an error message, "for loop index must be local" and won't compile the program. ------------------------------------------------------------------------ "Those whom the gods would destroy, they first make mad" He who steals my core-dump, steals trash