comp.lang.ada
 help / color / mirror / Atom feed
* Re: can a record contain an array whose bounds are not known at compile time?
       [not found] <2E74048954205C4EBEF1B2C592A559030840A2@satlrccdlmb03.delta.rl.delta.com>
@ 2002-10-25 15:08 ` David C. Hoos
  0 siblings, 0 replies; only message in thread
From: David C. Hoos @ 2002-10-25 15:08 UTC (permalink / raw)



----- 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
>




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-25 15:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2E74048954205C4EBEF1B2C592A559030840A2@satlrccdlmb03.delta.rl.delta.com>
2002-10-25 15:08 ` can a record contain an array whose bounds are not known at compile time? David C. Hoos

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