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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8002154d2966e1a1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-06 18:44:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!beastie.ix.netcom.com!nobody From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Local vs global variables in ADA Date: Wed, 06 Nov 2002 16:25:03 -0800 Organization: >> Leaf-Eating Penguins? << Message-ID: <0tbcqa.nk3.ln@beastie.ix.netcom.com> References: <5Ldx9.3695$151.38236@weber.videotron.net> <27331d9e.0211060640.6cb14b24@posting.google.com> NNTP-Posting-Host: a5.f7.db.67 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Server-Date: 7 Nov 2002 02:44:30 GMT User-Agent: KNode/0.6.1 X-noarchive: yes Xref: archiver1.google.com comp.lang.ada:30498 Date: 2002-11-07T02:44:30+00:00 List-Id: john mann fed this fish to the penguins on Wednesday 06 November 2002 06:40 am: > Dennis Lee Bieber wrote in message > news:... >> And /neither/ structure really handles the form where you >> need a bit >> of processing before you can do the test... >> >> >> loop >> preprocessing which sets flag >> exit when >> other processing >> end loop. >> > > > Well, you could use a function to get the while test value. > Couldn't you? Most of my experience is in FORTRAN, avoiding vendor specific extensions, but still... writing whole function WITH SIDE-EFFECTS and calling overhead to change read(unit,format, iostat=ios) v1, v2, v3 10 if (ios .ne. EOF_VALUE) then other processing read(unit,format, iostat=ios) v1, v2, v3 goto 10 endif into integer function funcwithsideeffects(a1,a2,a3) read(unit,format, iostat=is) a1, a2, a3 funcwithsideeffects = is return ... 10 if (funcwithsideeffects(v1,v2,v3) .ne. EOF_VALUE) then other processing goto 10 endif Would have gotten jeers from code inspections at my former employer. Especially as I'd have to document/justify the creation of those snippet functions. As it is, I only used "goto" in constructs where the destination was before the goto (as anyone reading the code should have seen the target already, and not have to search). This is why I did not fake the Ada loop/exit when/end loop in FORTRAN... If I had, the result would have looked like: 10 continue read(unit,format, iostat=ios) v1, v2, v3 if (ios .eq. EOF_VALUE) goto 20 other processing goto 10 20 continue Granted, Ada's I/O system is such that creating a procedure to consolidate the three variable reads into one is feasible -- but again, to put the status return into it still requires a function with side-effects if one wants to use while ... loop/end loop -- > ============================================================== < > wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed@dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ <