[net.lang.ada] Question about text_io

harbaughs@eglin-vax (04/16/86)

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
---------------------
------

Stachour@HI-MULTICS.ARPA ("Paul D. Stachour") (04/17/86)

   Sam:
      I believe the fragment to be correct Ada.  It works on the GCOS6
Honeywell/DDC compiler.  ...Paul (Stachour @ HI-Multics)