From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fc050a66c3b5d87d X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,86e8c626be2471ae X-Google-Attributes: gid1094ba,public From: Gary Scott Subject: Re: F9X twister & ADA (was: n-dim'l vectors) Date: 2000/04/09 Message-ID: <38EFCC9E.F06309AB@flash.net>#1/1 X-Deja-AN: 608541037 Content-Transfer-Encoding: 7bit References: <8cctts$ujr$1@nnrp1.deja.com> <38EA0440.1ECBC158@ncep.noaa.gov> <38ED4ECA.ADB698C9@sdynamix.com> <38EF6B75.DD12DD25@att.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flash.net X-Trace: news.flash.net 955239516 216.215.83.120 (Sat, 08 Apr 2000 19:18:36 CDT) Organization: Home MIME-Version: 1.0 Reply-To: scottg@flash.net NNTP-Posting-Date: Sat, 08 Apr 2000 19:18:36 CDT Newsgroups: comp.lang.fortran,comp.lang.ada Date: 2000-04-09T00:00:00+00:00 List-Id: Richard Maine wrote: > > Dick Hendrickson writes: > > > Here's what I'd try to do to modify the original F90 sample > > [elided] > > Not too different from what I'd have done. Dick did the most > important thing, which was to put it in a module. > > There are a few other things I'd probably do differently, but they are > smaller and are also definitely matters of personal style preferences. > I wouldn't say my style choice is better or worse - just different. > In particular... > > I avoid the DIMENSION keyword, choosing a slightly more compact style. > > I'd also have the "implicit none" at the module scope instead of in > the function (it gets inherited into the function). > > And I don't usually use a result clause for a function, so take it off and > replace all instances of z by my_func. > > Add appropriate comments and you'd then have pretty much the way I'd > have probably written this myself. That ends up with (except for > the comments, which I won't bother with here) Do we need the following mod? > > module some_functions > implicit none > contains > function my_func (x,y) > integer, intent(in) :: x(:), y(:) > integer :: my_func(size(x)) > ==> z = x + y ==> my_func = x + y > return > end function my_func > end module some_functions > > The calling stuff is the same. > > -- > Richard Maine > maine@qnet.com -- Gary Scott mailto:scottg@flash.net mailto:webmaster@fortranlib.com http://www.fortranlib.com Support the GNU Fortran G95 Project: http://xena.eas.asu.edu/~andy/