Article View: comp.lang.misc
Article #6705Re: Use of scope
From: Scott Schwartz
Date: Sun, 11 Feb 1990 07:25
Date: Sun, 11 Feb 1990 07:25
15 lines
972 bytes
972 bytes
In article <760@enea.se> sommar@enea.se (Erland Sommarskog) writes:
>Ada is really nice here. You declare the index variable with the FOR
>loop, so that you can only refer to it within the loop.
>
>The nightmare is standard Pascal where you must declare the variables
>before internal functions and procedures.
My favorite is "Stroustrup's revenge": in C++ you can write
for (int i = 0; ... ; ... ) { ... }
but the variable has scope outside the loop.
--
Scott Schwartz schwartz@cs.psu.edu
"the same idea is applied today in the use of slide rules." -- Don Knuth
Technical Details
Message-ID:
<Cb:3??2@cs.psu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!psuvax1!schwartzReferences:
<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!utgpu!jarvis.csri.toronto.edu!rutgers!psuvax1!schwartz From: schwartz@cs.psu.edu (Scott Schwartz) Newsgroups: comp.lang.misc Subject: Re: Use of scope Message-ID: <Cb:3??2@cs.psu.edu> Date: 11 Feb 90 07:25:31 GMT References: <PCG.90Feb5163252@rupert.cs.aber.ac.uk> <14226@lambda.UUCP> <760@enea.se> Organization: Penn State University Computer Science Lines: 15