From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ca6e1940d239274 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-17 09:28:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!colt.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed.siemens.de!news.mch.sbs.de!not-for-mail From: Alfred Hilscher Newsgroups: comp.lang.ada Subject: Re: unconstrainted arrays Date: Wed, 17 Oct 2001 18:28:32 +0200 Organization: Siemens AG Message-ID: <3BCDB1B0.52D3B04C@icn.siemens.de> References: <3BCDA15C.2976AF2@icn.siemens.de> NNTP-Posting-Host: 139.21.122.158 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:14825 Date: 2001-10-17T18:28:32+02:00 List-Id: Sorry, the description of my problem was bad. I try to make it clearer. My current problem is to define the record in such a way, that I can declare different variables like PTs_1 : s(10); PTs_2 : s(16); PTs_3 : s(24); PTs_4 : s(58); whereby the data must be always stored in the order X, Y, A(1), A(2) .. A(n). A trailing discriminant would be no problem, but nevertheeless should be avoided (if possible). The component "Len" is not really needed (I think I could obtain the length of "A" by A'Length, but I do not need it). Lutz Donnerhacke wrote: > > * Alfred Hilscher wrote: > >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. > > type hw_s10 is record > X,Y : Integer; > A : My_Array (1..10); > end record; > for hw_s10 use record > x at 0 range 0 .. 15; > y at 2 range 0 .. 15; > a at 4 range 0 .. 159; > end record; > > If you are requireing a special layout, describe it directly. If the > discriminant occurs in the record at an other place: No problem: > > type pascal_len is range 0 .. 255; > type pascal_string (len : pascal_len) is record > value : String (1 .. len); > end record; > for pascal_string use record > len at 0 range 0 .. 7; > end record; > pragma Pack (pascal_string);