comp.lang.ada
 help / color / mirror / Atom feed
From: Claude SIMON <claude.simon@setra.fr>
Subject: Re: unconstrainted arrays
Date: Wed, 17 Oct 2001 18:09:26 +0200
Date: 2001-10-17T16:07:05+00:00	[thread overview]
Message-ID: <3BCDAD35.BE53D854@setra.fr> (raw)
In-Reply-To: 3BCDA15C.2976AF2@icn.siemens.de



Alfred Hilscher a �crit :

> Hi,
>
> I know that I can define unconstrainted array where the actual
> constraints are given later:
>
> type My_Array is array (<>) of Integer;
>
> A1 : My_Array (1..10);
>
> Moreover I know a way to use this with structure:
>
> type s (len : integer) is record
>             X,Y : Integer;
>             A : My_Array (1..Len);
>      end record;
>
> PTs : s (10);
>
> But this would add one extra component to the record (Len). Is there a
> way to avoid this extra component ? Maybe a pragma or rep-specs ? Its
> encapsulated within a package body for HW handling where the extra
> component is unwanted.

One way is :

generic
   type Indices is range <>;
package Structure is
   type My_Array is array (Indices) of Integer;
   type S is record
            X,Y : Integer;
            A : My_Array;
     end record;
end Structure;


Claude Simon




      parent reply	other threads:[~2001-10-17 16:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-17 15:18 unconstrainted arrays Alfred Hilscher
2001-10-17 15:35 ` Lutz Donnerhacke
2001-10-17 16:28   ` Alfred Hilscher
2001-10-18  7:42     ` Lutz Donnerhacke
2001-10-18 11:03       ` Rep spec still not possible Petter Fryklund
2001-10-18 12:44         ` Lutz Donnerhacke
2001-10-18 17:10           ` Jeffrey Carter
2001-10-19 13:52             ` Exactly the prblem, how do we make a known constant value static? Petter Fryklund
2001-10-20  0:04               ` James Rogers
2001-10-20  2:53               ` Jeffrey Carter
2001-10-22  8:11                 ` We still don't know how to make a " Petter Fryklund
2001-10-17 16:09 ` Claude SIMON [this message]
replies disabled

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