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,d89e2d213646aec8 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!nnx.oleane.net!oleane!nnrp.oleane.net!skymaster!nobody From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Mneson announcement and help request Date: Fri, 4 Jun 2004 09:30:39 +0200 Organization: Adalog Message-ID: <2f8p9c.0p5.ln@skymaster> References: <-NSdneXjh7wndyLdRVn-vw@megapath.net> NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 1086336218 20100 195.25.228.57 (4 Jun 2004 08:03:38 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Fri, 4 Jun 2004 08:03:38 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Xref: g2news1.google.com comp.lang.ada:1089 Date: 2004-06-04T09:30:39+02:00 List-Id: > "Randy Brukardt" wrote in message > news:-NSdneXjh7wndyLdRVn-vw@megapath.net... > > My point was that as long as you keep the exception handler and raising > out > > of the loop (which is certainly true for EOF), it can be quite efficient. > In > > the normal case (where you read many characters before reaching the end of > > the file), it's almost always better to handle the exception. That's > because > > one exception raise/handling pair is a lot cheaper than 10,000 function > > calls, especially one as expensive as EOF. I always use the exception mechanism for another reason: In the presence of a "malformed" file (i.e. one where the last line has no line terminator before EOF), you may have an unexpected End_Error even if End_Of_File was false. Of course, this is outside Ada semantics, but it's the real world that text files are sometimes being typed by human beings.... So, in short: 1) when you do a Get, it will have to (more or less) check EoF anyway 2) if you check EoF, you must still be prepared to catch End_Error anyway => I never check EoF any more. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr