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.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!eglin-vax!harbaughs From: harbaughs@eglin-vax Newsgroups: net.lang.ada Subject: Question about text_io Message-ID: <8604162332.AA07365@ucbvax.berkeley.edu> Date: Wed, 16-Apr-86 16:56:00 EST Article-I.D.: ucbvax.8604162332.AA07365 Posted: Wed Apr 16 16:56:00 1986 Date-Received: Fri, 18-Apr-86 05:38:53 EST Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Organization: The ARPA Internet List-Id: Text_IO continues to be my Nemesis. In the following code which is from Booch's book and also is like an example in the LRM (page 14-33) the following is reported by my students to happen on both the DEC compiler under VMS and the Alsys compiler (version 1.00) on the IBM PC/AT: When the person at the keyboard enters a bad data value the program goes into a non-ending loop as if an input buffer containing the bad input is read over and over again and not flushed. Inserting a dummy get_line in the exception handler seems to flush this apparent buffer and make the program work as desired. My question is : Is this the way it's supposed to work (endless loop) or is there a hole in the validation suite or are my students doing something wrong. Any comments would be appreciated. -- type RESPONSE is (UP,DOWN,LEFT,RIGHT); USER_RESPONSE : RESPONSE; loop begin PUT(">"); GET(USER_RESPONSE); exit; exception when DATA_ERROR => PUT_LINE("Invalid Response"); end; end loop; -- Thanks in advance. regards, sam harbaugh --------------------- ------