Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.lang Subject: Re: does Fortran 77 allow recursion? Message-ID: <4203@alice.UUCP> Date: Sat, 24-Aug-85 14:37:27 EDT Article-I.D.: alice.4203 Posted: Sat Aug 24 14:37:27 1985 Date-Received: Sun, 25-Aug-85 03:24:27 EDT References: <1349@umcp-cs.UUCP> Organization: Bell Labs, Murray Hill Lines: 28 Charley Wingate points out that there are many Fortran programs that use DATA statements to initialize values that are later changed. It may interest all of you to know that programs that do that violate the Fortran 77 standard. Page 8-11, section 8.9: 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: 1. Entities specified by SAVE statements 2. Entities in blank common 3. Initially defined entities that have neither been redefined nor become undefined 4. Entities in a named common block that appears in the subprogram and appears in at least one other program unit that is referencing, either directly or indirectly, that subprogram Thus you can initialize a variable with a DATA statement in a subprogram and have it retain its value AS LONG AS YOU NEVER ASSIGN A VALUE TO IT ELSEWHERE. If you do assign it elsewhere, YOU MUST NAME IT IN A SAVE STATEMENT or it will become undefined when you return.