Xref: utzoo comp.lang.fortran:2375 comp.os.vms:16987 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!orstcs!nucthy!ghe From: ghe@nucthy.physics.orst.edu (Guangliang He) Newsgroups: comp.lang.fortran,comp.os.vms Subject: Re: Question about variables local to subroutine Keywords: Local variables, subroutines Message-ID: <12181@orstcs.CS.ORST.EDU> Date: 23 Aug 89 06:21:09 GMT References: <24891@iuvax.cs.indiana.edu> Sender: usenet@orstcs.CS.ORST.EDU Reply-To: ghe@nucthy.PHYSICS.ORST.EDU (Guangliang He) Organization: Dept. of Physics, Oregon State University Lines: 25 In article <24891@iuvax.cs.indiana.edu> templon@silver.bacs.indiana.edu (jeffrey templon) writes: = =I would like to know one simple (I hope) thing: what happens if you set =the value of a variable (local) in a subroutine, exit the subroutine, and =come back later? Is it the same value, zero, or worse? I read all TFMs =I could find and saw no answer to this one. I am using VAX Fortran, =whatever version runs on VMS V4.6. Thanks for any help you can send. = = Jeff Templon As my understanding, Fortran 77 standard does NOT save the value of a local variable unless you use save in the subroutine. But I am not very sure about the detail. A lot of compilers do save the value of local variables. The Unix f77 does it. But I have heard the oppesite case. The Mac Fortran doesn't save them. You should read the manual carefully to see how VAX Fortran does these kind things. ----------------------------------------------------------------------- | USMAIL: Guangliang He | INTERNET: ghe@PHYSICS.ORST.EDU Department of Physics | BITNET: hegl@ORSTVM.BITNET Oregon State University | Corvallis, OR 97331 | PHONE: (503) 737-4631 | -----------------------------------------------------------------------