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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1b6f0735bc6de58e,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!s33g2000vbb.googlegroups.com!not-for-mail From: tonyg Newsgroups: comp.lang.ada Subject: index check failure - constraint error Date: Fri, 1 Apr 2011 03:53:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 82.46.232.121 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1301655196 31537 127.0.0.1 (1 Apr 2011 10:53:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Apr 2011 10:53:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s33g2000vbb.googlegroups.com; posting-host=82.46.232.121; posting-account=28F2IwkAAACL1Z5nRC-dE7zuvWdbWC7P User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.04 (lucid) Firefox/3.6.16,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19629 Date: 2011-04-01T03:53:16-07:00 List-Id: 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 ?