Path: utzoo!attcan!uunet!convex!convex1.convex.com!rosenkra From: rosenkra@convex1.convex.com (William Rosencranz) Newsgroups: comp.lang.fortran Subject: Re: another side effect question Keywords: function, print Message-ID: <104561@convex.convex.com> Date: 2 Aug 90 07:45:48 GMT References: <968@nikhefh.nikhef.nl> Sender: usenet@convex.com Organization: Convex Computer Corporation; Richardson, TX Lines: 54 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 > > >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). > >Geert Jan van Oldenborgh >oldenborgh@nikhef.nl you can't do i/o during a print statement, i believe, since this is recursive which fortran does not like too much. note that you CAN do this in C: double app(); main () { printf ("%6.4f\n", app(1.)); } double app(arg) double arg; { printf ("THIS IS AAP\n"); return (arg); } it would result in: THIS IS AAP 1.0000 C has no problems at all with recursion, in general, another reason it should not be dismissed... -bill rosenkra%c1yankee@convex.com (my opinions, not my employer's...) Bill Rosenkranz |UUCP: {uunet,texsun}!convex!c1yankee!rosenkra Convex Computer Corp. |ARPA: rosenkra%c1yankee@convex.com