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,5430b81ad265fc75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-13 23:28:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!news-out.triton.net!triton.net!newsfeeder.triton.net!203.50.2.88.MISMATCH!lon-transit.news.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: Array Of Constant Strings? References: User-Agent: MT-NewsWatcher/3.3b1 (PPC Mac OS X) Message-ID: Date: Fri, 14 Feb 2003 07:28:33 GMT NNTP-Posting-Host: 144.132.47.50 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 1045207713 144.132.47.50 (Fri, 14 Feb 2003 18:28:33 EST) NNTP-Posting-Date: Fri, 14 Feb 2003 18:28:33 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:34090 Date: 2003-02-14T07:28:33+00:00 List-Id: In article , Dr Nancy's Sweetie wrote: > Maybe I'm just doing this wrong, but the only solution I can see > looks unreasaonbly verbose. > > What I want is to set up an array of constant strings, all the same > length. I tried using Ada.Strings.Bounded, with something like > this: > > package Name_Package is new Generic_Bounded_Length(7); > > type Name_String is new Digit_Package.Bounded_String; > > Name_List : constant array(1..26) of Name_String := > ("Anthony", "Barbara", "Claudia", "Deborah" "Elliott", > .... and so on. > a more versatile solution would be to use aliased strings, and string pointers. type String_Ptr is access all String; -- defined in the Ada hierachy somewhere... type Strings is array (Positive range <>) of String_Ptr; a : aliased String := "Anthony"; b : aliased String := "Bert"; c : aliased String := "Carla"; List : Strings := (a'Access, b'access, c'access); (or should that be 'Unrestricted_Access?) not as compact as C, but you end up with the same effect. Dale