From: tmoran@acm.org
Subject: Re: unconstrained array question
Date: Sun, 23 Nov 2003 08:42:59 GMT
Date: 2003-11-23T08:42:59+00:00 [thread overview]
Message-ID: <nq_vb.281842$Tr4.870539@attbi_s03> (raw)
In-Reply-To: 4948f537.0311222312.43d843c5@posting.google.com
>type Arr is Array(Integer range<>) of Character;
>Input_Line : String (1..256);
So Input_Line is of type String, and Arr is a different type.
> n:=new Arr'(Input_Line);
"Arr'()" says "the thing inside the parens is of type Arr". But in fact
the thing inside the parens is not an Arr, but is a String. So the
compiler quite rightly points out that it expected something of type Arr.
Perhaps what you want is
subtype Arr is String;
which, since there are no special constraints, would in effect mean
that "Arr" is a synonym for "String". Of course even easier is just
to forget about "Arr" entirely, and just use "String" where you now
have "Arr".
> Get_LIne(Input_Line,LAST);
> n:=new Arr'(Input_Line);
If you want "n" to point to just the data read, and not the whole
256 characters, you want
n:=new Arr'(Input_Line(Input_Line'first .. LAST));
next prev parent reply other threads:[~2003-11-23 8:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-22 17:39 unconstrained array question shoko
2003-11-22 18:11 ` Marius Amado Alves
2003-11-23 7:12 ` shoko
2003-11-23 8:42 ` tmoran [this message]
2003-11-23 12:16 ` Marius Amado Alves
2003-11-23 18:03 ` shoko
2003-11-23 20:16 ` Marius Amado Alves
2003-11-24 17:40 ` shoko
2003-11-24 18:16 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2003-11-24 18:11 amado.alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox