From: collins@cs.wm.edu (Bob Collins)
Subject: Is there an integer in "0: abc"?
Date: 1997/04/17
Date: 1997-04-17T00:00:00+00:00 [thread overview]
Message-ID: <collins-1704970713110001@ratbert.cs.wm.edu> (raw)
I get Data_Error when I try to "Get" a number from
the string "0: abc" and "1: abc" but not "2: abc".
I assume (Annex J) that the colon is substituting for
the sharp symbol # used in a based integer, and,
of course, 0 and 1 can't be bases. But there is no
corresponding closing : anywhere. Have I run afoul
of some basic Ada rules? Or is this an error in my
favorite Macintosh Ada compiler? (BTW, I always get
an error for "2:abc", and this behavior is also
present when "Get"ting from files.)
Here's a code example:
with Ada.Integer_Text_IO, Ada.Text_IO;
use Ada.Integer_Text_IO, Ada.Text_IO;
procedure Test is
Last : Natural;
Number : Integer;
begin
Get ("2: abc", Number, Last);
Put (Number); New_Line;
Get ("1: abc", Number, Last);
Put (Number); New_Line;
exception
when Data_Error =>
Put_Line ("Data_Error raised.");
Get ("0: abc", Number, Last);
Put (Number); New_Line;
end Test;
Here is what happens:
ny > gnatmake -v test
GNATMAKE 3.09 (970121) Copyright 1995 Free Software Foundation, Inc.
"test.ali" being checked ...
-> "test.ali" missing.
gcc -c test.adb
gnatbind -x test.ali
gnatlink test.ali
ny > test
2
Data_Error raised.
raised ADA.IO_EXCEPTIONS.DATA_ERROR
Bob Collins, collins@cs.wm.edu
reply other threads:[~1997-04-17 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox