comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: unconstrained array type problems
Date: Wed, 21 Jul 2004 17:33:16 +0000 (UTC)
Date: 2004-07-21T17:33:16+00:00	[thread overview]
Message-ID: <cdm9cs$877$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 87vfghl456.fsf@insalien.org

Ludovic Brenta <ludovic.brenta@insalien.org> wrote:
: 
: begin
:   Get (File, number_rows_1);
:   Get (File, number_columns_1);
:   Get (File, number_rows_2);
:   Get (File, number_columns_2);
: 
:   declare
:      array1: Matrix_Type (1 .. number_rows, 1 .. number_columns);
:      array2: Matrix_Type (1 .. number_rows, 1 .. number_columns);
:   begin
:      -- read in array1
:      -- read in array2
:      -- multiply array1 by array2 (array multiplication)
:   end;
: end;

Maybe things can be made a bit more separate:


   subtype Realistic_Index is Positive range 1 .. 50;
   --   declared womewhere or "generically"

   type Matrix_Data is
     array(Realistic_Index range <>, Realistic_Index range <>)
     of Value;

   type Matrix(rows, columns: Realistic_Index) is limited  -- !
      record
         item: Matrix_Data(1 .. rows, 1 .. columns);
      end record;

   procedure Read(filename: String; m: in out Matrix);


This way a Matrix object can be declared and constrained
before cell items are read. Copying is avoided if I'm not
mistaken?


-- Georg



  reply	other threads:[~2004-07-21 17:33 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
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 [this message]
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