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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,744136b4fae1ff3e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-10 12:03:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feed2.news.rcn.net!rcn!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Reply-To: "James S. Rogers" From: "James S. Rogers" Newsgroups: comp.lang.ada References: Subject: Re: [Spark] Converting Arrays X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: <1c6ba.19009$Oz1.770240@bgtnsc05-news.ops.worldnet.att.net> Date: Mon, 10 Mar 2003 20:03:09 GMT NNTP-Posting-Host: 12.86.33.56 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1047326589 12.86.33.56 (Mon, 10 Mar 2003 20:03:09 GMT) NNTP-Posting-Date: Mon, 10 Mar 2003 20:03:09 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:35150 Date: 2003-03-10T20:03:09+00:00 List-Id: "Lutz Donnerhacke" wrote in message news:slrnb6phge.1gd.lutz@taranis.iks-jena.de... > I run into a difficult problem (for me): > $ cat test.ada < package test is > type Fullpath is array(Positive range <>) of Character; > procedure To_Fullpath (s : String; path : out Fullpath); > --# derives path from s; > end test; > > package body test is > procedure To_Fullpath (s : String; path : out Fullpath) is > begin > path := Fullpath'(others => ASCII.NUL); > for i in Positive range 1 .. s'Length loop > path (path'First + i) := s (s'First + i); > end loop; > end To_Fullpath; > end test; change the initialization of "path" as follows: path := (others => ASCII.NUL); Note that another problem looms in your code. The "for" loop will attempt to access one element beyond the end of string "s". It appears that you are trying to copy s into path while skipping the first element of s. This can be done more directly and correctly with array slices: if s'Length <= path'Length then path(path'First..(path'First + s'Length - 1)) := s((s'First + 1)..s'Last); end if; You will need to decide how to handle the case when path is shorter than s. Jim Rogers