From: Erik J Pessers <epessers@tiscali.be>
Subject: A question re meaning/use of the "for ... use ..."
Date: Sun, 05 Dec 2004 16:27:39 +0100
Date: 2004-12-05T16:28:31+01:00 [thread overview]
Message-ID: <41b3291e$0$44072$5fc3050@dreader2.news.tiscali.nl> (raw)
Hi,
A question re meaning/use of the "for ... use ..." construct.
Given the code snippet at the bottom of this mail, I was sort of
expecting to see an output reading like:
Pos for AA : 0
Pos for BB : 2
Pos for CC : 3
Instead (when compiling with bot Gnat3.15p and Gnat-3.4.2-2),
the actual code output reads:
Pos for AA : 0
Pos for BB : 1
Pos for CC : 2
Anybody who can shed some light, and explain what will be
going on behind the curtains?
TIA, Erik Pessers
===
with Ada.Text_IO ;
procedure t is
type enm is (aa, bb, cc) ;
for enm use
(aa => 0,
bb => 2,
cc => 3);
begin
for i in enm'Range loop
Ada.Text_IO.Put_Line ("Pos for " & enm'Image(i) & " :" &
Integer'Image(enm'Pos(i))) ;
end loop ;
end t ;
next reply other threads:[~2004-12-05 15:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-05 15:27 Erik J Pessers [this message]
2004-12-05 15:47 ` A question re meaning/use of the "for ... use ..." Martin Krischik
2004-12-05 15:59 ` Stephen Leake
2004-12-05 16:52 ` Jeffrey Carter
2004-12-06 19:59 ` Randy Brukardt
2004-12-07 1:36 ` Jeffrey Carter
2004-12-07 2:40 ` David C. Hoos, Sr.
2004-12-07 20:59 ` Randy Brukardt
2004-12-08 1:41 ` Jeffrey Carter
2004-12-08 8:40 ` Martin Dowie
2004-12-08 16:23 ` Georg Bauhaus
2004-12-08 3:18 ` Keith Thompson
2004-12-08 13:48 ` David C. Hoos
2004-12-08 19:50 ` Randy Brukardt
2004-12-08 23:00 ` Keith Thompson
2004-12-09 23:06 ` Randy Brukardt
2004-12-10 2:26 ` Keith Thompson
2004-12-10 19:42 ` Randy Brukardt
2004-12-10 21:18 ` Keith Thompson
2004-12-11 0:53 ` Keith Thompson
2004-12-10 3:13 ` David C. Hoos
2004-12-10 9:23 ` Keith Thompson
2004-12-10 13:24 ` David C. Hoos
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox