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,8623fab5750cd6aa X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!news.jgaa.com!news.hacking.dk!pnx.dk!munin.nbi.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Ragged arrays of strings (Was: Improving Ada's image) Date: 19 Jun 2004 20:10:36 +0200 Organization: Munin Sender: sparre@sparre.crs4.it Message-ID: References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <7J0xc.7371$8k4.269106@news20.bellglobal.com> <1086630278.542788@master.nyc.kbcfp.com> <8xlxc.27603$sS2.845496@news20.bellglobal.com> <1086715817.122983@master.nyc.kbcfp.com> <3Auxc.11998$XY6.1296622@read2.cgocable.net> <40C85035.4020706@noplace.com> <40C9EC3B.60304@noplace.com> <40CD90A4.8030005@noplace.com> <40CEDCB5.9000509@noplace.com> <1087325485.307616@master.nyc.kbcfp.com> <1087488758.881520@master.nyc.kbcfp.com> NNTP-Posting-Host: 80.241.165.43 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: munin.nbi.dk 1087668637 14603 80.241.165.43 (19 Jun 2004 18:10:37 GMT) X-Complaints-To: sparre@munin.nbi.dk NNTP-Posting-Date: Sat, 19 Jun 2004 18:10:37 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:1695 Date: 2004-06-19T20:10:36+02:00 List-Id: Pascal Obry wrote: > type String_Access is access constant String; > type Color_Set is array (Positive range <>) of String_Access; > > Red : aliased constant String := "Red"; > Green : aliased constant String := "Green"; > Blue : aliased constant String := "Blue"; > > Colors : constant Color_Set := (Red'Access, Green'Access, Blue'Access); I tend to use Ada.Strings.Unbounded for ragged arrays of strings. I suppose it gives a larger overhead than an array of pointers to constant strings, but I like to avoid having to define the intermediate objects (here the aliased constants Red, Green and Blue) explicitly. Jacob -- "Nobody writes jokes in base 13." Douglas Adams