🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6707

Re: Use of scope

#6707
From: Darren New
Date: Mon, 12 Feb 1990 18:56
15 lines
1379 bytes
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
Technical Details
Message-ID: <10878@nigel.udel.EDU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!emory!mephisto!udel!new
References: <PCG.90Feb5163252@rupert.cs.aber.ac.uk> <14226@lambda.UUCP> <760@enea.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <PCG.90Feb5163252@rupert.cs.aber.ac.uk> <14226@lambda.UUCP> <760@enea.se>
Sender: usenet@udel.EDU
Reply-To: new@udel.edu (Darren New)
Organization: University of Delaware
Lines: 15