Path: utzoo!attcan!uunet!samsung!emory!mephisto!udel!new From: new@udel.edu (Darren New) Newsgroups: comp.lang.misc Subject: Re: Use of scope Message-ID: <10878@nigel.udel.EDU> Date: 12 Feb 90 18:56:44 GMT References: <14226@lambda.UUCP> <760@enea.se> Sender: usenet@udel.EDU Reply-To: new@udel.edu (Darren New) Organization: University of Delaware Lines: 15 In article <760@enea.se> sommar@enea.se (Erland Sommarskog) writes: >The nightmare is standard Pascal where you must declare the variables >before internal functions and procedures. If you have a loop in the main >body that calls an internal routine that has another loop and use the >variable name i in both cases is jolly fun when you forgot to declare >the i in the inner function. Actually, in standard Pascal, such a construct is illegal. If you have a loop index, it is not allowed to be "threatened" by anything inside the loop, including functions or procedures called. I think most compilers that check such things check that it does not get passed as a var parameter. I may be wrong, but I also think it is illegal to use a more-global variable as a loop index; i.e., the inner function would be considered illegal because it uses a non-local var as a loop index. Of course, if your compiler does not check this, you're stuck. -- Darren