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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f2ff548f619cc58 X-Google-Attributes: gid103376,public From: "Robert I. Eachus" Subject: Re: End of File for streams Date: 2000/04/17 Message-ID: <38FBA3B4.BBE9078E@earthlink.net>#1/1 X-Deja-AN: 612460784 Content-Transfer-Encoding: 7bit References: <8df15j$e4b$1@trog.dera.gov.uk> <38FB5996.C7CCB816@maths.unine.ch> <8dg55l$us3$1@trog.dera.gov.uk> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 956015423 63.24.60.115 (Mon, 17 Apr 2000 16:50:23 PDT) Organization: The MITRE Corporation MIME-Version: 1.0 NNTP-Posting-Date: Mon, 17 Apr 2000 16:50:23 PDT Newsgroups: comp.lang.ada Date: 2000-04-17T00:00:00+00:00 List-Id: Kevin Rigotti wrote: > > OK, its nice to have some external confirmation occasionally. I don't get to > see much code written by other people here ... > > In my own defence (but thanks Brian) > 1) as an impressionable undergrad I was brought up on a diet of functional > programming so using exceptions for control flow seems decadent :-) > > 2) I don't like using exceptions for non-exceptional behavior. Just a > personal foible. The "normal" Ada design for reading entries from a file uses the End_Error exception as an exception, while correct data results in an exit due to End_Of_File: while not End_Of_File(Input_File) loop begin Get_Item_1; Get_Item_2; Get_Item_3; exception when End_Error | Data_Error | Device_Error => Correct_Partial_Entry; when others => ... end; end loop; Reading a character at a time is a degenerate case, and you can do that either way. I guess it is not considered a major issue in Ada, since the expected behavior is to read data in larger chunks. (Stream files are a different situation, and there the expected behavior when you run out of data is to wait for more. ;-)