From: Adam Beneschan <adam@irvine.com>
Subject: Re: Array of Strings
Date: Mon, 15 Sep 2008 07:54:10 -0700 (PDT)
Date: 2008-09-15T07:54:10-07:00 [thread overview]
Message-ID: <d42d16bd-bc40-486e-a0a5-daedef43940a@w39g2000prb.googlegroups.com> (raw)
In-Reply-To: fda9aa48-6029-469e-82fb-20bb99d750c6@73g2000hsx.googlegroups.com
On Sep 13, 7:18 am, jedivaughn <jedivaugh...@gmail.com> 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
next prev parent reply other threads:[~2008-09-15 14:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-13 14:18 Array of Strings jedivaughn
2008-09-13 14:32 ` Ludovic Brenta
2008-09-14 0:11 ` anon
2008-09-14 9:45 ` Per Sandberg
2008-09-15 14:54 ` Adam Beneschan [this message]
2008-09-16 23:56 ` jedivaughn
2008-09-23 14:07 ` jedivaughn
2008-09-23 14:30 ` mockturtle
2008-09-23 14:41 ` Adam Beneschan
2008-09-23 14:47 ` Ludovic Brenta
2008-09-23 18:51 ` Jeffrey R. Carter
2008-09-24 12:00 ` jedivaughn
2008-09-24 14:36 ` Adam Beneschan
2008-09-24 15:13 ` John McCormick
2008-09-24 17:18 ` Jeffrey R. Carter
2008-09-28 12:24 ` jedivaughn
2008-09-28 13:01 ` mockturtle
2008-09-28 17:08 ` jedivaughn
2008-09-29 11:14 ` mockturtle
2008-09-28 19:00 ` Jeffrey R. Carter
2008-09-29 15:51 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox