From: tonyg <tonythegair@gmail.com>
Subject: Re: index check failure - constraint error
Date: Fri, 1 Apr 2011 04:07:49 -0700 (PDT)
Date: 2011-04-01T04:07:49-07:00 [thread overview]
Message-ID: <738ba46b-dfd1-4a28-9392-0be197a1b6d0@l5g2000vbx.googlegroups.com> (raw)
In-Reply-To: a60d3c79-14ca-4cf1-87d4-a51c061effff@s33g2000vbb.googlegroups.com
On Apr 1, 11:53 am, tonyg <tonytheg...@gmail.com> wrote:
> I'm getting a constraint error and I cannot see why...
>
> function String_To_Integer (The_String : String) return Integer is
> String_Length : Integer := The_String'length;
> Return_Value : Integer := 0;
> subtype Number_Character is character range '0'..'9';
> begin
> Int_Io.Put(String_Length);
> Ada.Text_IO.Put_Line (The_String);
> if String_Length > 0 then
> for count in 1..String_Length loop
> case The_String(count) is
> when Number_Character =>
> Return_Value := Return_Value +
> ((Character'pos(The_String(count)) - 48) *
> (10**(count-1)));
> when others =>
> raise Conversion_Error_Exception;
> end case;
> end loop;
> else
> Return_Value := 0;
> end if;
>
> return Return_Value;
>
> end String_To_Integer;
>
> I checked to see there was a string going in and it had a length. The
> actual error was 'index check failure' but as far as I can see
> everything is present and correct. Can anyone see what it is ?
The index check failure occurred at
case The_String(count) is
btw
next prev parent reply other threads:[~2011-04-01 11:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 10:53 index check failure - constraint error tonyg
2011-04-01 11:07 ` tonyg [this message]
2011-04-01 11:27 ` Alex Mentis
2011-04-01 11:33 ` Alex Mentis
2011-04-01 11:36 ` Alex Mentis
2011-04-01 12:18 ` Georg Bauhaus
2011-04-01 22:20 ` tonyg
2011-04-01 23:37 ` Ludovic Brenta
2011-04-01 11:12 ` Egil Høvik
2011-04-01 11:17 ` tonyg
2011-04-01 12:13 ` Ludovic Brenta
2011-04-01 15:02 ` Adam Beneschan
2011-04-01 17:39 ` Jeffrey Carter
2011-04-01 22:16 ` tonyg
2011-04-01 22:31 ` Jeffrey Carter
2011-04-01 22:49 ` Robert A Duff
2011-04-01 23:00 ` Adam Beneschan
2011-04-01 23:29 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox