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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,146ef816afa699d1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.38.38 with SMTP id d6mr21236023pbk.4.1318769561012; Sun, 16 Oct 2011 05:52:41 -0700 (PDT) Path: d5ni16340pbc.0!nntp.google.com!news1.google.com!news3.google.com!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!ramfeed-1.ams.xsnews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!upload-2.xsnews.nl!10.10.69.10.MISMATCH!frontend-F09-10.ams.news.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada References: <4e9a9a6d$0$3238$703f8584@news.kpn.nl> <9fvo6aF3d6U1@mid.individual.net> In-Reply-To: <9fvo6aF3d6U1@mid.individual.net> Subject: Re: Length of unbounded_string. Date: Sun, 16 Oct 2011 14:52:22 +0200 MIME-Version: 1.0 Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Message-ID: <4e9ad365$0$3267$703f8584@news.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1318769509 news.kpn.nl 3267 77.168.179.107@kpn/77.168.179.107:62015 Xref: news1.google.com comp.lang.ada:18489 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit Date: 2011-10-16T14:52:22+02:00 List-Id: Sorry I just thought to simplify the problem but did that the wrong way my real problem is in the following code: ch := Element(str, len); if ch = ',' or (ch /= ';' and ch /= '{' and ch /= '}') then nr := nr + 1; str := str & " " & Next_Line; where in the first line print str.reference.data $24 = "static void gtk_print_job_set_property (GObject *object", ',' , "["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]" len = 56 ch = ',' in fact the first print str.reference.data $386 = "static void gtk_print_job_set_property (GObject *object, guint", ' ' , "prop_id,["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]" in the display option instead of rhe print option this shows as "static void gtk_print_job_set_property (GObject *object guint", ' ' , "prop_id,["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]["0d"]["f0"]["ad"]["ba"]" and when I save that line later on the comma after object is also disapperared L. Dries "Niklas Holsti" schreef in bericht news:9fvo6aF3d6U1@mid.individual.net... On 11-10-16 10:48 , ldries46 wrote: > In my program I use unbounded_string str > > I want to change the last character of the string using the program lines > > 2205 len := Length(str); > 2206 Replace_Slice(str, len, len, "G"); Similar code works for me (debian, gnat). It seems to me that code like the above can fail with Constraint_Error only if str is the null string, in which case len = 0, which causes a Constraint_Error in the call because the 2nd parameter of Replace_Slice is of subtype Positive. > Then I get the following message printed in my exception part of the > program ... > Original line : /* GtkPrintJob ... > In this print out the Original line represents "str". Are you certain that your "str" is really that, and is not a null string? I would put a check in the code, before the call of Replace_Slice, and not trust the exception messages. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .