comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Multidimensional array vs. array of array
Date: Wed, 12 Dec 2001 08:39:28 +0000 (UTC)
Date: 2001-12-12T08:39:28+00:00	[thread overview]
Message-ID: <slrna1e5tv.kc.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: u3d2hl5pk.fsf@gsfc.nasa.gov

* Stephen Leake wrote:
>lutz@iks-jena.de (Lutz Donnerhacke) writes:
>> How does a skilled Ada programmer define a return type containing a
>> multidimensional array? 
>
>I suspect the answer is : you don't. Define a procedure with an 'in
>out' parameter instead. Or one 'in' and one 'out'.

Parameters of unconstraint type always have the constraints as in parameters.
In order to obtain the constraints from the calling procedure, you have to
return an unconstraint type.

Returning a multidimensional array is easy.
Returning an array of arrays is impossible.

A multidimensional array is often unusable in further processes. There a
array of arrays is necessary. Of course, I can use Unchecked_Conversion,
but this is not portable and not a good style.

>> But this approach fails miserably on extracting a single row from the
>> result as well as on construction the result in a recursive function.
>
>Yes, this is a fundamental limitation. If you think about a reasonable
>implementaion of multi-dimensional arrays, and what you are asking the
>compiler to do, it will make sense that it is a limitation.

I read all the discussions about Ada83/95 multidimensional arrays and know
where the limitation comes from. But I still ask: How does a skilled Ada
programmer return a array of arrays?



  reply	other threads:[~2001-12-12  8:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-11 22:22 Multidimensional array vs. array of array Lutz Donnerhacke
2001-12-11 22:45 ` Mark Lundquist
2001-12-17 15:56   ` Lutz Donnerhacke
2001-12-11 23:03 ` Stephen Leake
2001-12-12  8:39   ` Lutz Donnerhacke [this message]
2001-12-13  0:26     ` James Rogers
2001-12-13  9:02       ` Lutz Donnerhacke
2001-12-13 21:49         ` Nick Roberts
2001-12-14  9:45           ` Lutz Donnerhacke
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox