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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,36f8d2f5234c3238,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-31 10:36:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: ANH_VO@udlp.com Newsgroups: comp.lang.ada Subject: Re[2]: I'm baffled... Date: Wed, 31 Oct 2001 10:03:18 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1004553394 46142 137.194.161.2 (31 Oct 2001 18:36:34 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 31 Oct 2001 18:36:34 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: Content-Description: cc:Mail note part Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:15497 Date: 2001-10-31T10:03:18-06:00 << 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