comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Enumeration representation
Date: 1999/09/10
Date: 1999-09-10T00:00:00+00:00	[thread overview]
Message-ID: <7rbvhv$1sc$1@nnrp1.deja.com> (raw)
In-Reply-To: 37d9061a@news1.prserv.net

In article <37d9061a@news1.prserv.net>,
  "Matthew Heaney" <matthew_heaney@acm.org> wrote:
> The image of literal B is of course "B".  But I don't know
what 'Img will
> return if you also use pragma Discard_Names.

Well, you know what we do to answer such questions, we consult
the super-secret archives known as the GNAT documentation,
carefully hidden from sight by being included in every
copy of GNAT distributed :-) There we find:

  <<Pragma Discard_Names causes names of enumeration literals to
    be suppressed. In the presence of this pragma, the Image
    attribute provides the image of the Pos of the literal, and
    Value accepts Pos values>>

The exact effect is implementation defined, and choosing the
pos seems as reasonable as any other choice. Choosing the
representation would be definitely a bad idea, the point of
a enumeration representation clause is that it does NOT affect
the semantics of programs, ONLY the representation.

> GNAT seems to be displaying the value of T'Pos.

which, considering the above documentation, is what we expect!

> You want to underlying representation.  If so, you'll have use
> Unchecked_Conversion to convert the literal to an integer, and
then display
> that.
>
> An alternative is to use the GNAT-specific attribute 'Enum_Rep
(I think
> that's what it's called).


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-09-10  0:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-10  0:00 Enumeration representation Alex
1999-09-10  0:00 ` David C. Hoos, Sr.
1999-09-10  0:00   ` Robert Dewar
1999-09-10  0:00 ` Matthew Heaney
1999-09-10  0:00   ` Robert Dewar [this message]
1999-09-10  0:00 ` Keith Thompson
1999-09-11  0:00   ` Robert Dewar
1999-09-11  0:00     ` Keith Thompson
1999-09-12  0:00       ` Bryce Bardin
1999-09-13  0:00         ` Robert Dewar
1999-09-13  0:00           ` Keith Thompson
1999-09-13  0:00       ` Robert Dewar
1999-09-12  0:00         ` Keith Thompson
1999-09-13  0:00           ` Robert Dewar
1999-09-13  0:00             ` Ted Dennison
1999-09-13  0:00             ` Keith Thompson
1999-09-14  0:00               ` Robert Dewar
1999-09-13  0:00         ` Robert A Duff
1999-09-13  0:00           ` Robert Dewar
1999-09-10  0:00 ` Ted Dennison
1999-09-10  0:00   ` Robert Dewar
1999-09-13  0:00     ` Ted Dennison
1999-09-13  0:00 ` Alex
  -- strict thread matches above, loose matches on Subject: below --
2004-01-01 20:44 Luke A. Guest
2004-01-01 21:45 ` Stephen Leake
2004-01-01 22:01   ` Luke A. Guest
2004-01-02  1:17     ` tmoran
2004-01-02  1:29     ` Stephen Leake
2004-01-02  3:10       ` Luke A. Guest
2004-01-02  2:46 ` Robert A Duff
2004-01-02  3:12   ` Luke A. Guest
2004-01-02 13:58   ` Marin David Condic
2004-01-02 21:39     ` Pat Rogers
2004-01-03 13:42       ` Marin David Condic
2004-01-03  1:53     ` Robert A Duff
2004-01-02 20:52   ` Randy Brukardt
2004-01-02 21:05     ` Luke A. Guest
replies disabled

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