Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!ucsd!rutgers!bellcore!texbell!petro!swrinde!kent From: kent@swrinde.swri.edu (Kent D. Polk) Newsgroups: comp.lang.pascal Subject: Re: Control variables in FOR loops Message-ID: <6811@swrinde.swri.edu> Date: 14 Dec 88 18:44:58 GMT References: <1439@csuna.UUCP> Reply-To: kent@swrinde.UUCP (Kent D. Polk) Organization: Southwest Research Institute, San Antonio, Texas Lines: 25 In article <1439@csuna.UUCP> abcscnuk@csun.UUCP (Naoto Kimura) writes: > > I have gotten into some pretty heated discussions regarding the >control variable in a for loop. I was arguing that it was a bad idea to >use a global variable, in fact it is an error to do so. I'm arguing >from the ISO standard, while the people I was arguing against were going >by specific implementations that allowed it. > > Should the use of a relatively global variable be allowed as a >control variable for a for loop ? Should the use of a passed parameter >be allowed as a control variable ? I say no to both of these. > Try porting a program written in Turbo Pascal which makes use of these interesting 'features'. I have always used Pascal compilers which follow the ISO standard in this respect - Forcing the use of local variables for control loop variables, & have NEVER seen an instance where it was necessary or even desirable (to me). The coding standards at places I have worked would also not allow it, and I support those decisions. I have thrown out work submitted to me which implemented such features because it costs ($$$) to maintain such software. ======================================================================== Kent Polk - Southwest Research Institute |>Insert Standard< {cs.utexas.edu, gatech!petro, sun!texsun}!swrinde!kent|> Disclaimer < ========================================================================