From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: unconstrained array type problems
Date: Wed, 21 Jul 2004 17:09:06 +0200
Date: 2004-07-21T17:08:12+02:00 [thread overview]
Message-ID: <87zn5tl7n1.fsf@insalien.org> (raw)
In-Reply-To: wDvLc.542$pr3.465@roc.nntpserver.com
"zork" writes:
> procedure Matrix is
>
> type Matrix_Type is array ( Integer range <>, Integer range <> ) of
> Float;
> ..
> ..
> begin
> ..
> Get ( File, number_rows ); -- read the number of rows from file
> Get ( File, number_columns ); -- read the number of columns from file
> array1 : Matrix_Type ( 1 .. number_rows, 1 .. number_columns );
> ..
> end Matrix;
> ------------------
>
> I cant seem to define my array1 in the begin / end block. This is a bit
> frustrating. How does one get around this? Is an unconstrained array the
> best choice?
>
> Any help most appreciated!
You can do it with a declare block:
begin
Get (File, number_rows);
Get (File, number_columns);
declare
array1: Matrix_Type (1 .. number_rows, 1 .. number_columns);
begin
-- process array1
end;
end;
But if your processing is long, consider changing the declare block to
a subprogram, and passing number_columns and number_rows to it.
--
Ludovic Brenta.
next prev parent reply other threads:[~2004-07-21 15:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-21 15:04 unconstrained array type problems zork
2004-07-21 15:09 ` Ludovic Brenta [this message]
2004-07-21 15:33 ` zork
2004-07-21 15:54 ` Marius Amado Alves
2004-07-21 16:24 ` Ludovic Brenta
2004-07-21 17:33 ` Georg Bauhaus
2004-07-21 17:35 ` zork
2004-07-21 18:30 ` tmoran
2004-07-21 23:11 ` zork
2004-07-22 7:57 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox