comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Enumerations and rep-clauses?
Date: 2000/02/28
Date: 2000-02-28T18:33:02+00:00	[thread overview]
Message-ID: <38BABF5D.A278EF9A@averstar.com> (raw)
In-Reply-To: 38ba8b87.252446008@news.rrds.co.uk

Steve Folly wrote:
> 
> Hi,
> 
> Given the following Ada95 situation...
> 
>   type enum is ( a, b, c, d );
> 
>   for enum use ( a => 12, b => 24, c => 36, d => 48 );
> 
>   subtype half_enum is enum range a .. b;
> 
> Is it guaranteed anywhere that half_enum has the same representation attributes
> as enum? (ie. half_enum(a) => 12 and half_enum(b) => 24)

Yes.

> 
> I would hope it did, but I'm having trouble finding the particular LRM
> paragraph.

An enumeration representation clause specifies a "type-related" aspect
of representation, so it is shared by all subtypes.  See RM95 13.1(8) which
indicates that all rep clauses other than Size and Alignment clauses
are type-related.  (Size and Alignment are subtype-specific.)
> 
> Thanks for your help.
> 
> --
> Regards,
> Steve Folly.
> mailto:Steve.Folly@rdel.co.uk

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  reply	other threads:[~2000-02-28  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-28  0:00 Enumerations and rep-clauses? Steve Folly
2000-02-28  0:00 ` Tucker Taft [this message]
2000-02-28  0:00   ` Steve Folly
replies disabled

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