comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Enumeration representation
Date: 01 Jan 2004 16:45:28 -0500
Date: 2004-01-01T16:45:28-05:00	[thread overview]
Message-ID: <mailman.197.1072993540.31149.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <pan.2004.01.01.20.44.22.548593@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk>

"Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> writes:

> Hi,
> 
> Am I correct in saying that enumerations don't necessarily begin at zero?

Hmm. Say you have:

type Enum is (One, Two, Three);

Enum'first is One (one definition of "begin" :).

Enum'Pos (Enum'first) is 0 (RM 3.5.1 (7) - first position number)

However, none of that says what is stored in RAM. If you specify a
representation clause:

for Enum_Type use 
  (One => 1,
   Two => 2,
   Three => 3);

Then One will be stored as 1 in RAM. The above values for 'first and
'pos are not changed.

> Is this implementation dependent?

In the absence of a representation clause, the representation in RAM
is technically implementation dependent, but it's extremely
likely to be the same as the position number.

-- 
-- Stephe




  reply	other threads:[~2004-01-01 21:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01 20:44 Enumeration representation Luke A. Guest
2004-01-01 21:45 ` Stephen Leake [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
1999-09-10  0:00 Alex
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             ` Keith Thompson
1999-09-14  0:00               ` Robert Dewar
1999-09-13  0:00             ` Ted Dennison
1999-09-13  0:00         ` Robert A Duff
1999-09-13  0:00           ` Robert Dewar
1999-09-10  0:00 ` Matthew Heaney
1999-09-10  0:00   ` Robert Dewar
1999-09-10  0:00 ` David C. Hoos, Sr.
1999-09-10  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
replies disabled

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