comp.lang.ada
 help / color / mirror / Atom feed
* A question re meaning/use of the "for ... use ..."
@ 2004-12-05 15:27 Erik J Pessers
  2004-12-05 15:47 ` Martin Krischik
  2004-12-05 15:59 ` Stephen Leake
  0 siblings, 2 replies; 23+ messages in thread
From: Erik J Pessers @ 2004-12-05 15:27 UTC (permalink / 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 ;



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2004-12-11  0:53 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-05 15:27 A question re meaning/use of the "for ... use ..." Erik J Pessers
2004-12-05 15:47 ` 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

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