Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!lll-winken!ncis.tis.llnl.gov!blackbird!news From: news@blackbird.afit.af.mil (News System Account) Newsgroups: comp.sys.atari.st Subject: Re: Absoft Fortran Summary: SAVE command Message-ID: <1440@blackbird.afit.af.mil> Date: 7 Dec 89 11:49:24 GMT References: <891207024528.958022@DMZRZU71-UNI-MAINZ--GERMANY> Reply-To: dbell@galaxy-43.UUCP (David E. Bell) Organization: Air Force Institute of Technology; WPAFB, OH Lines: 37 In article <891207024528.958022@DMZRZU71-UNI-MAINZ--GERMANY> Ritzert@DMZRZU71.BITNET writes: > There is a serious bug >in the compiler (version 2.3): > >If You want to use a common block only in some subroutines You have to >declare it in Your main program. Otherwise You will get unpredictable >results. This is the only Fortran compiler I have used which behaves >this way (and I have been writing Fortran programs on many systems). > >Michael Ritzert >mjr@dmzrzu71.bitnet This is not a bug. The FORTRAN standard does not require that a common block that is first initialized in a subroutine be saved after the subroutine is exited; although, most FORTRAN implementations do save it. (Sorry, I can't quote the Standard but you can see, for instance, Michael Metcalf's Effective Fortran 77, page 83.) If you would like to keep the common block around and don't want to clutter up the main program by declaring it there use the save command: subroutine foo(args) real args,stuff common/bar/stuff SAVE /bar/ . . . This should work (at least it does in compiler version 2.2). (It sure is nice to finally see some discussion on a real programming language in this newsgroup :-) David E. Bell dbell@galaxy-43.UUCP dbell@afit-ab.arpa