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!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Re: Record representation Date: Tue, 15 Jun 2004 08:37:19 +0100 Organization: BAE SYSTEMS Message-ID: <40cea5f7$1_1@baen1673807.greenlnk.net> References: <40c6d3d1$1_1@baen1673807.greenlnk.net> X-Trace: news.uni-berlin.de m78eRdyWonTDmvAlyi9MHwDxDtDuAyeDF/yFpLtReuRQjRmtum X-Orig-Path: baen1673807.greenlnk.net!baen1673807!not-for-mail X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Original-NNTP-Posting-Host: baen1673807.greenlnk.net Xref: g2news1.google.com comp.lang.ada:1494 Date: 2004-06-15T08:37:19+01:00 List-Id: "Randy Brukardt" wrote in message news:TfGdnTVBHqyzZlrd4p2dnA@megapath.net... > "Martin Dowie" wrote in message > news:40c6d3d1$1_1@baen1673807.greenlnk.net... > > 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. > > While I've had this problem myself, it occurs mainly because of an abuse of > the language (or not trusting compilers to do the right thing). The > important point is that 'Size on a composite type is not supposed to change > the sizes of the components (see 13.3(53)), so it really only can be a > confirming specification - not very interesting. Hardly worth changing the > language over. > > When I've had this problem, I'll generally declare appropriate constants: Randy, Thanks for that - this looks like the pick of the bunch. It is down to not trusting compilers but the problem I've had at many sites is coding standards that mandate this practise for always having 'Size clauses and that are set in stone. :-( Cheers -- Martin