From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 28 Jun 93 20:58:06 GMT From: dst17!mab@ford-wdl1.arpa (Mark A Biggar) Subject: Re: Retrieving Rep Spec'ed Enumeration Values Message-ID: <1993Jun28.205806.11601@wdl.loral.com> List-Id: In article wise@cs.umass.edu writes: >Suppose you had a type like so: > type Color is ( Red, Green, Blue ); > for Color use ( Red => 4, Green => 8, Blue => 16 ); >I cannot seem to find a portable way to retrieve the values assigned >in the rep-spec. Color'Pos is explicitly defined to be unaffected by >the rep spec (LRM 13.3 paragraph 6). The only protable way is to use Unchecked_conversion. But, why does your program even need to get at the rep values? If your program needs to work with anything other then the enumeration identifiers, then it very likely has a very badly broken abstraction. I have never seen an Ada program that required emuneration rep specs, that really required the internal representation to become visible in the program. But, if you really really need it just declare an anonymous array to be used for conversions: internal_colors: array (Color) of integer := (4,8,16); -- Mark Biggar mab@wdl.loral.com