From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: unconstrained array clarification
Date: 1998/09/22
Date: 1998-09-22T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.98Sep22161458@spectre.mitre.org> (raw)
In-Reply-To: WishList-1909981042300001@a1.phoenix-7.goodnet.com
In article <WishList-1909981042300001@a1.phoenix-7.goodnet.com> WishList@2600.com (Technobabble) writes:
> What I want to do is to keep the addresses for several arrays of records
> of different lengths in an array of pointers. Then write the contents of
> each record to I/O. The problem is to do this with only the array of
> pointers, if I don't want to keep track of the size of each array (number
> of records), and I want to use the RANGE attribute to determine the size.
> But the only way I have of getting to the array of records is via the
> pointer. I didn't design this stuff either, it's adopted from legacy
> code. I'll re-code the stuff in GNAT with the changes you've supplied and
> see if I can get a good compile.
What you want to do is to declare an access type which is your
object type:
type XYZ is private;
type XYZ_Array is array(Natural range <>) of XYZ;
...
private
type XYZ_Object is array(Natural range <>) of Foo;
type XYZ is access XYZ_Object;
If Foo is Character, you can use Ada.Strings.Unbounded, otherwise
you can use the GNAT implementation to see how to make it all work.
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1998-09-22 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-19 0:00 unconstrained array clarification Technobabble
1998-09-19 0:00 ` Tucker Taft
1998-09-19 0:00 ` Technobabble
1998-09-19 0:00 ` dewarr
1998-09-22 0:00 ` Robert I. Eachus [this message]
1998-09-19 0:00 ` dewarr
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox