Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: comp.lang.fortran Subject: Re: Semantics of local variables Summary: use the SAVE statement Message-ID: <2079@ttrdc.UUCP> Date: 8 Jan 88 18:19:30 GMT References: <2617@killer> <3669@aw> Organization: AT&T, Skokie, IL Lines: 30 In article <3669@aw>, firth@aw writes: #> In article <2617@killer.UUCP> richardh@killer.UUCP (Richard Hargrove) writes: #> >... [does] a DATA statement force ... [a] variable to have static #> >scope? #> #> The quick answer: No. #> #> You'll find it in ANSI X3.9-1978 para 17.3 (6) #> "The execution of a RETURN statement or an END statement #> within a subprogram causes all entities within the subprogram #> to become undefined except for the following: #> ... #> (b) Initially defined entities that have neither been redefined #> nor become undefined #> ... #> " #> As you say, most compilers will let you get away with this, since they make #> the variables static. However, there are other legitimate implementations. #> If you want to follow the standard, don't ever assume more than it guarantees. This kind of behavior can also be assured by using the SAVE statement, e.g., DATA FOO /1.0/ ... SAVE FOO -- |------------Dan Levy------------| Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, | an Engihacker @ | }!ttrdc!ttrda!levy | AT&T Computer Systems Division | Disclaimer? Huh? What disclaimer??? |--------Skokie, Illinois--------|