comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Record representation
Date: 09 Jun 2004 20:38:10 -0400
Date: 2004-06-09T20:38:10-04:00	[thread overview]
Message-ID: <mailman.84.1086827906.391.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <40c6d3d1$1_1@baen1673807.greenlnk.net>

"Martin Dowie" <martin.dowie@baesystems.com> writes:

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

     Max_Index : constant := 10;

>    type Index is new Integer range 1 .. 10;

     type Index is new Integer range 1 .. Max_Index;
> 
>    type AA is array (Index) of A;
>    for AA'Size use A'Size * Index'Last;  -- Not allowed!!!!!

     for AA'Size use A'Size * Max_Index;

> end Record_Rep;
> 
> Surely the language could be made smart enough to support this? This can be
> a real maintenance nightmare to change.

If Ada doesn't let you do it, there is a better way :).

On the other hand, I agree it would be nice if Index'Last were static
in this instance. But 'Last can't be static in general, so it's
reasonable for it to be never static.

-- 
-- Stephe




  parent reply	other threads:[~2004-06-10  0:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09  9:14 Record representation Martin Dowie
2004-06-09 11:38 ` Martin Krischik
2004-06-09 14:11   ` Martin Dowie
2004-06-09 15:30 ` Mark H Johnson
2004-06-09 16:58   ` Martin Dowie
2004-06-09 17:44     ` tmoran
2004-06-09 20:08     ` Mark H Johnson
2004-06-09 21:12       ` Martin Dowie
2004-06-09 21:14       ` Martin Dowie
2004-06-10  0:38 ` Stephen Leake [this message]
2004-06-10  6:13   ` Randy Brukardt
2004-06-10  6:10 ` Randy Brukardt
2004-06-15  7:37   ` Martin Dowie
replies disabled

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