Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!milton!seymour From: seymour@milton.u.washington.edu (Richard Seymour) Newsgroups: comp.lang.fortran Subject: Re: another side effect question Keywords: function, print Message-ID: <5806@milton.u.washington.edu> Date: 1 Aug 90 18:00:49 GMT References: <968@nikhefh.nikhef.nl> Organization: University of Washington, Seattle Lines: 31 In article <968@nikhefh.nikhef.nl> t19@nikhefh.nikhef.nl (Geert J v Oldenborgh) writes: > >While on the subject of side effect of functions, is there anything in the >(77) standard which prohibits > > PRINT *,AAP(1.) > END > REAL FUNCTION AAP(X) > PRINT *,'THIS IS AAP' > AAP = X > END > --- yes, there is: page 12-29, section 12.11 "Restrictions on Function References and List Items" "A function must not be referenced within an expression appearing anywhere in an input/output statement if such a reference causes an input/output statement to be executed." another way to look at it is to consider the PRINT statement as a subroutine call (sort of) -- so haveing a PRINT invoke a PRINT is recursion, which we all know Fortran thinks is nasty (page 3-6). > >None of the Fortrans I use properly prints this. Yet, I find it a useful >construct to remind me which set of functions I am using (of course only >printing on the first call). ... many things are useful, Fortran just doesn't let you do them (legally) good luck --dick