* Question about text_io
@ 1986-04-16 21:56 harbaughs
0 siblings, 0 replies; 2+ messages in thread
From: harbaughs @ 1986-04-16 21:56 UTC (permalink / 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
---------------------
------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Question about text_io
@ 1986-04-17 17:22 "Paul D. Stachour"
0 siblings, 0 replies; 2+ messages in thread
From: "Paul D. Stachour" @ 1986-04-17 17:22 UTC (permalink / raw)
Sam:
I believe the fragment to be correct Ada. It works on the GCOS6
Honeywell/DDC compiler. ...Paul (Stachour @ HI-Multics)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1986-04-17 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-04-16 21:56 Question about text_io harbaughs
-- strict thread matches above, loose matches on Subject: below --
1986-04-17 17:22 "Paul D. Stachour"
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox