comp.lang.ada
 help / color / mirror / Atom feed
From: harbaughs@eglin-vax
Subject: Question about text_io
Date: Wed, 16-Apr-86 16:56:00 EST	[thread overview]
Date: Wed Apr 16 16:56:00 1986
Message-ID: <8604162332.AA07365@ucbvax.berkeley.edu> (raw)

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

             reply	other threads:[~1986-04-16 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-04-16 21:56 harbaughs [this message]
  -- strict thread matches above, loose matches on Subject: below --
1986-04-17 17:22 Question about text_io "Paul D. Stachour"
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox