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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,100c539a37d7d2e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-14 22:58:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: chained List manipulation without recusrsion : lost the begining of my List! Date: 15 May 2003 06:58:01 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1052978311 1229 62.49.19.209 (15 May 2003 05:58:31 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 15 May 2003 05:58:31 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:37339 Date: 2003-05-15T06:58:01+01:00 List-Id: "Zeg" writes: > procedure Insert_iteratif(E : in Element; L : in out Liste) is > Aux : Liste := L; > Z : Liste := null; You don't need to initialize access variables, they are automatically set to null for you > begin > if (Aux = null) then > Aux := new Maillon'(E,null); L was empty, so what is it pointing to now? Should you have altered it? > else > while (Aux /= null) loop > if (Aux.all.valeur > E) then > L := new Maillon'(E,Aux); What has happened to all the previous elements in the list? (that L used to be pointing to) > exit; > elsif (Aux.all.suivant = null) then > L:= new Maillon'(E,null); What has happened to all the previous elements in the list? > exit; > end if; > z := Aux ; What is Z for? You don't read it anywhere > Aux := Aux.all.suivant; > end loop; > end if; > > end Insert_iteratif; It might help you to draw a picture of Maillons linked into a Liste, and how you want a new Maillon to be linked in.