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=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,20c6ebf06f55144e X-Google-Attributes: gid103376,public From: Amal Kurian Subject: Re: input/output exceptions Date: 2000/11/18 Message-ID: <8v6lfe$rc7$07$1@news.t-online.com>#1/1 X-Deja-AN: 695177891 Content-Transfer-Encoding: 8Bit References: <3A2B4CF6@MailAndNews.com> <8v64ob$j2e$1@nnrp1.deja.com> <8v6ct8$jvj$07$1@news.t-online.com> X-Sender: 320097644692-0001@t-dialin.net Content-Type: text/plain; charset=ISO-8859-1 X-Complaints-To: abuse@t-online.com X-Trace: news.t-online.com 974575919 07 28039 j8YCX2GS1aPyk 001118 19:31:59 Organization: T-Online Mime-Version: 1.0 User-Agent: KNode/0.3.2 Newsgroups: comp.lang.ada Date: 2000-11-18T00:00:00+00:00 List-Id: While Robert Dewar pointed out, that 2.54 contains 2 and "junk" he should also have stated that since 2.54 is the last value to be read in, Ada ignores the junk and the program finishes while it couldn't ignore it if there is still something to be read in. Because a string consists of "junk" only ;) an exception is always raised. To illustrate this, consider the modificated procedure: with Ada.Integer_Text_IO, Ada.Float_Text_IO; use Ada.Integer_Text_IO, Ada.Float_Text_IO; procedure Test_Type_IO is First : Integer := 0; Second : Float := 0.0; begin Get(First); Get(Second); Put(First); Put(Second); end Test_Type_IO; and the following values: 2.54 2 5.40000E-01 Obviously the ignored "junk" from 2.54, that is 0.54, is a perfect float and is therefore assigned to 'Second'. Kind regards, Amal Kurian DuckE wrote: > > "Amal Kurian" wrote in message > news:8v6ct8$jvj$07$1@news.t-online.com... > > Robert Dewar wrote: > > > > > In article <3A2B4CF6@MailAndNews.com>, > > > Jean Cohen wrote: > > > 2.54 > > > > > > I see an integer there, namely a 2, followed by junk, that's > > > what Ada sees too! > > > > > > > > > Sent via Deja.com http://www.deja.com/ > > > Before you buy. > > > > However while remaining quiet if the second number contains "junk" Ada > > screams loud if the same "junk" is contained in the first number. And I > > think that's what the original poster was wondering about. > > > > I believe Robert answered the question. If the first number entered is > 2.54, an exception will occur when trying to read the second number. > > SteveD > > >