comp.lang.ada
 help / color / mirror / Atom feed
From: Larry Coon <larry@fs2.assist.uci.edu>
Subject: Re: Exception problem
Date: 1997/02/19
Date: 1997-02-19T00:00:00+00:00	[thread overview]
Message-ID: <330B2898.4E52@fs2.assist.uci.edu> (raw)
In-Reply-To: 01bc1e5e$a43929a0$148c71a5@dhoossr.iquest.com


David C. Hoos, Sr. wrote:
> 
> The problem is that when Text_IO.Data_Error is raised in this circumstance,
> the pointer in the input stream is backed up to where it was before the
> Int_IO.Get was called.  Therefore, if you want to skip over this
> non-numeric data in the input stream, you should call Text_IO.Skip_Line
> just after the line:
> Put_Line ("Entry must be a number.  Try again.");

Thanks.  Michael Feldman also pointed this out, and it worked like a
charm.
 
> Incidentally, Ada is much more civilized than C++.  We don't "throw"
> things.  Exceptions are simply "raised."

And apparently in Ada you're more sure of yourselves, because you don't
"try" things either!  ;-)

> One other point about your code.  Instantiations of generics (e.g.,
> Text_IO.Integer_IO) for commonly used types are better placed at the
> Library level, so all parts of your program can use the same instantiation.
>  Depending on the compiler/binder/linker used, code for multiple identical
> instantations may or may not share the code.

Oh, it was in the real code, but this was a contrived example to
demonstrate the problem.

Thanks for your response.

Larry Coon
University of California
larry@fs2.assist.uci.edu




  parent reply	other threads:[~1997-02-19  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-18  0:00 Exception problem Larry Coon
1997-02-18  0:00 ` Michael Feldman
1997-02-19  0:00   ` Larry Coon
1997-02-19  0:00 ` David C. Hoos, Sr.
1997-02-19  0:00   ` Robert Dewar
1997-02-19  0:00   ` Larry Coon [this message]
1997-02-19  0:00 ` Joerg Rodemann
1997-02-19  0:00   ` Mats Weber
1997-02-19  0:00 ` Keith Allan Shillington
1997-02-22  0:00 ` Arthur Evans Jr
1997-02-24  0:00   ` Larry Coon
1997-02-24  0:00     ` Larry Kilgallen
1997-02-24  0:00       ` Larry Coon
1997-02-25  0:00         ` Fergus Henderson
1997-02-25  0:00     ` Do-While Jones
1997-03-09  0:00       ` John Volan
1997-03-09  0:00         ` Robert Dewar
1997-03-12  0:00         ` Keith Thompson
1997-02-25  0:00   ` Robert I. Eachus
replies disabled

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