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,54a7591bed8148f2 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!news.linkpendium.com!border1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!cyclone-sf.pbi.net!151.164.30.34!cyclone.swbell.net!bos-service1.raytheon.com!dfw-service2.ext.ray.com.POSTED!53ab2750!not-for-mail From: Mark H Johnson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Record representation References: <40c6d3d1$1_1@baen1673807.greenlnk.net> In-Reply-To: <40c6d3d1$1_1@baen1673807.greenlnk.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 09 Jun 2004 10:30:06 -0500 NNTP-Posting-Host: 192.27.48.39 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.ray.com 1086795016 192.27.48.39 (Wed, 09 Jun 2004 10:30:16 CDT) NNTP-Posting-Date: Wed, 09 Jun 2004 10:30:16 CDT Organization: Raytheon Company Xref: g2news1.google.com comp.lang.ada:1319 Date: 2004-06-09T10:30:06-05:00 List-Id: Martin Dowie wrote: > Is there anything that could be done (quickly ;-) by the ARG for Ada200Y to > do something about this common pain in the *ss? > > package Record_Rep is > > type A is record > I : Integer; > end record; > for A'Size use Integer'Size; > > type Index is new Integer range 1 .. 10; > > type AA is array (Index) of A; > for AA'Size use A'Size * Index'Last; -- Not allowed!!!!! > > end Record_Rep; > > Surely the language could be made smart enough to support this? This can be > a real maintenance nightmare to change. > Let's generalize the situation slightly. What do you suggest be done if you change the data type from an Integer to a Natural? Using GNAT on x86's, Natural'Size is 31 (not 32) so that would imply setting AA'Size to 310 (and not 320) w/ a real pain in the *ss due to packing / unpacking of the data. I remember a private email exchange with Robert Dewar about something similar to this a few years ago. Let me see if I can dig up the suggestions he had to improve the portability of your code. --Mark