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,ed290afd6f09a679 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Initialize with aggregate? Date: Mon, 21 Nov 2005 21:49:31 +0000 Organization: Pushface Message-ID: References: <1132602018.206322.285630@g44g2000cwa.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1132609771 10256 62.49.19.209 (21 Nov 2005 21:49:31 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 21 Nov 2005 21:49:31 +0000 (UTC) Cancel-Lock: sha1:8qlOT9zQ1trmfX44SuF1Ed7nu74= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news1.google.com comp.lang.ada:6519 Date: 2005-11-21T21:49:31+00:00 List-Id: ejijott@gmail.com writes: > Regarding the code below, what syntax do I use to initialize tempstore > with an aggregate? > [code] > . > . > . > type node; > type storage is access node; > type node is > record > next: storage; -- Pekare till n�sta nod. > item: string(1..50); -- En textstr�ng > len: integer :=-1; -- L�ngden p� str�ngen. > count: integer := 0; -- Antalet f�rekomster av str�ngen > end record; > . > . > . > tempstore:=new Node; > tempstore.item(1 .. Val'length):=Val; > tempstore.len:=Val'length; > tempstore.count:=1; > if S /= null then > tempstore.next:=S; > end if; > S:=tempstore; > [/code] S := new Node'(Next => S, Item => <>, Len => Val'Length, Count => 1); If S is null then it can do no harm to assign it to the new node's Next field. You might consider replacing Item and Len by a bounded string of length up to 50.