comp.lang.ada
 help / color / mirror / Atom feed
From: jbg@sei.cmu.edu (John Goodenough)
Subject: Re: enumeration literal/internal codes query
Date: 15 Jan 89 04:42:46 GMT	[thread overview]
Message-ID: <8217@aw.sei.cmu.edu> (raw)
In-Reply-To: arny@wayback.UUCP's message of 10 Jan 89 23:15:41 GMT

In article Re: enumeration literal/internal codes query of 10 Jan 89 23:15:41
GMT arny@wayback.UUCP (Arny B. Engelson) writes:

>>    After specifying internal codes for the literals of an enumeration type
>>    using an enumeration representation clause, how do you (later in the
>>    code) find out what internal codes were specified?

>'POS gives the position number, which always starts at 0 (RM 3.5.1),
>and increments by 1 for each successor.  This has NOTHING TO DO with
>the internal codes specified in an enumeration representation clause.
>
>Also, I know Unchecked_Conversion can be used (by converting to an integer
>type of the appropriate size), but this is extremely messy
>(repeated instantiations for each enumeration type to be converted), and
>not at all what I had in mind.  There should be a better way.

I know of no way other than Unchecked_Conversion to get at the actual internal
codes.  This has been remarked on a few times at language maintenance
committee meetings.  Robert Dewar (I think) has also pointed out that you
can't access the internal representation of _any_ data type in the language.
Even for integers, you only think you know the internal representation because
it is so commonly a signed, unbiased representation, but if an implementation
supports biased representation (e.g., when a record component is implemented
with two bits because the component has the range 4..6), you can't detect the
actual representation used any more than you can for enumeration literals.

To argue that this is a language deficiency worthy of being corrected in the
9X revision, you need to describe the programming requirement for which this
may be the correct solution, using the suggested revision request format.

John B. Goodenough					Goodenough@sei.cmu.edu
Software Engineering Institute				412-268-6391

  parent reply	other threads:[~1989-01-15  4:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-01-09 15:25 enumeration literal/internal codes query Arny B. Engelson
1989-01-10 23:15 ` Arny B. Engelson
1989-01-13 17:03   ` Scott Moody
1989-01-16 18:03     ` Badger BA 64810
1989-01-19 19:44       ` Scott Moody
1989-01-31 18:05         ` Arny B. Engelson
1989-01-15  4:42   ` John Goodenough [this message]
1989-01-12  0:31 ` Michael Murphy
1989-01-12 15:51 ` enumeration literal/internal codes stt
1989-01-20 15:04 ` ryer
  -- strict thread matches above, loose matches on Subject: below --
1989-01-13 21:29 enumeration literal/internal codes query rracine
replies disabled

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