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,ca20ac98709f9b4a X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!postnews.google.com!w39g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Array of Strings Date: Mon, 15 Sep 2008 07:54:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1221490450 4123 127.0.0.1 (15 Sep 2008 14:54:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Sep 2008 14:54:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w39g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2021 Date: 2008-09-15T07:54:10-07:00 List-Id: On Sep 13, 7:18 am, jedivaughn wrote: > Hi everyone, > > I'm having trouble making a array of type string. can some one show me > how to do this. I've tried type letters is array (Integer range <>) of > String; but I get error "unconstrained element type in array > declaration". what am I doing wrong? One of the things that needs to be impressed upon newer Ada programmers is that Ada's String type is *not* a varying-length string. Some languages have varying-length strings built into them, like BASIC and Perl; you can just assign a 2-character string into a string variable, and later change it to an 80-character string, and later to an empty (zero-length) string, and so on, without worrying too much. (I believe there are many other languages that also have this sort of string type.) Ada's String type is not like this. A String variable has a particular length and that length cannot be changed. (Maybe it was a mistake to name it "String" because of the potential for confusion.) Ludovic already mentioned Bounded_String and Unbounded_String which were added in Ada 95 to fill that hole. -- Adam