From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: can a record contain an array whose bounds are not known at compile time?
Date: Fri, 25 Oct 2002 10:08:50 -0500
Date: 2002-10-25T10:08:50-05:00 [thread overview]
Message-ID: <mailman.1035558542.9347.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 2E74048954205C4EBEF1B2C592A559030840A2@satlrccdlmb03.delta.rl.delta.com
----- Original Message -----
From: "Yu, Liyang" <Liyang.Yu@delta.com>
To: <comp.lang.ada@ada.eu.org>
Sent: Friday, October 25, 2002 9:05 AM
Subject: can a record contain an array whose bounds are not known at compile
time?
> Hi,
>
> I need to use an array in a record and this array's bound is not known at
> compile time. Can Ada do this? Can someone give me a example about how to
do
> this or any reference that I can use?
>
Better (in my view) than the use of discriminated records suggested by
others is to first declare an access type to the array type, then use a
record
component of the array access type. E.g, if the array is an array of
Integers
type Integer_Array is array (Natural range <>) of Integer;
type Integer_Array_Access is access all Integer_Array;
type MyRecord is record
Integers : Integer_Array_Access;
end record;
> Thanks!
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
parent reply other threads:[~2002-10-25 15:08 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <2E74048954205C4EBEF1B2C592A559030840A2@satlrccdlmb03.delta.rl.delta.com>]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox