Re: Array of Strings
- From: Adam Beneschan <adam@xxxxxxxxxx>
- Date: Mon, 15 Sep 2008 07:54:10 -0700 (PDT)
On Sep 13, 7:18 am, jedivaughn <jedivaugh...@xxxxxxxxx> 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
.
- Follow-Ups:
- Re: Array of Strings
- From: jedivaughn
- Re: Array of Strings
- References:
- Array of Strings
- From: jedivaughn
- Array of Strings
- Prev by Date: Re: Large Hadron Collider - software?
- Next by Date: [Announcement] MacPorts / Mac OS X Release for GCC 4.3.2
- Previous by thread: Re: Array of Strings
- Next by thread: Re: Array of Strings
- Index(es):
Relevant Pages
|