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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8a34575d5eb275cb X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.banetele.no!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Fri, 03 Apr 2009 15:41:04 +0200 From: =?ISO-8859-1?Q?Thomas_L=F8cke?= Organization: Ada DK User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Load an object from a file References: <49d5fa88$0$2862$ba620e4c@news.skynet.be> In-Reply-To: <49d5fa88$0$2862$ba620e4c@news.skynet.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <49d611f1$0$90264$14726298@news.sunsite.dk> NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=`3V3LU[[30BlZiKmBn9NRLYSB=nbEKnkK5l7JOAVQ`jB]KcSoP8OK@H@kCUDmHHZ?E:WTk`c[X5;OBJ^5^;=0GDj4C X-Complaints-To: staff@sunsite.dk Xref: g2news2.google.com comp.lang.ada:5392 Date: 2009-04-03T15:41:04+02:00 List-Id: Olivier Scalbert wrote: > But I do not know what is the best (Ada) way of representing the array > of info constant_pool as the size is only known at run time.(= > constant_pool_cout). > Also how can I fill this array ? > > Thanks to help me and have a nice day. Hey Olivier, I don't know if it's the "best" way, but I would use Ada.Containers.Vector in your case. Here's a small example: ----- with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers.Vectors; use Ada.Containers; procedure Vec is type CP_Info_Type is new String (1 .. 3); package Constant_Pool_Container is new Vectors (Natural, CP_Info_Type); Constant_Pool : Constant_Pool_Container.Vector; CP_Info : CP_Info_Type; begin CP_Info := "Foo"; Constant_Pool.Append (New_Item => CP_Info); CP_Info := "Bar"; Constant_Pool.Append (New_Item => CP_Info); CP_Info := "42!"; Constant_Pool.Append (New_Item => CP_Info); for i in 0 .. Constant_Pool.Last_Index loop Put_Line (String (Constant_Pool.Element (Index => i))); end loop; end Vec; ----- If all goes well, output should be: Foo Bar 42! You can read more about Ada.Containers.Vectors here: http://adaic.org/standards/05rm/html/RM-A-18-2.html :o) /Thomas