* Re[2]: I'm baffled...
@ 2001-10-31 16:03 ANH_VO
0 siblings, 0 replies; only message in thread
From: ANH_VO @ 2001-10-31 16:03 UTC (permalink / raw)
To: comp.lang.ada
<< subtype index is positive range word_list'range;
current_index jumps around but is always in index >>
Here is your problem. First, I would like to recapture the function call here
for easy discussion.
Result : Index := 47;
begin
Result := ASF.Index (
Source => Word_List (Current_Index + 1 .. Word_List'Last),
Pattern => Pattern,
Going => AS.Forward );
The problem is that the function ASF.Index returns 0 if pattern is not found.
However, the Result is declared as Positive, type Index. Therefore,
Constraint_Error is raised at the assignment.
The obvious solution is to change Index type to include 0. As far as error
message is concerned, I think GNAT gave a very confusing / incorrect message,
a-strmap.ads:166. In addition, APEX and ObjectAda pointed to the exact line
where the Constraint_Error was raised.
A. Vo
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-10-31 16:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-31 16:03 Re[2]: I'm baffled ANH_VO
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox