From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9f437cff8842e X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Enumeration representation Date: 1999/09/10 Message-ID: <7rb8c3$fql$1@nnrp1.deja.com>#1/1 X-Deja-AN: 523399125 References: <37D8E3BC.175DB72C@newtech.it> X-Http-Proxy: 1.0 x34.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Fri Sep 10 15:33:23 1999 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 1999-09-10T00:00:00+00:00 List-Id: In article <37D8E3BC.175DB72C@newtech.it>, Alex wrote: > type Status is (a,b,c,d,e); > pragma Discard_Names(Status); > > for Status use > ( a => 0, > b => 20, > c => 400, > d => 800, > e => 1600); > > S : Status; > begin > S := b; > Put(" => " & S'img); > end MainEnum; > > I've compiled it with Gnat (the latest version) > the output of program is 1 but I was expecting another value : 20. > Does Gnat support this clause? 'img is not defined in Ada. It's a Gnat attribute. The Gnat RM I have says this should be equivalent to Status'image(S), in which case I'd expect to see you get a "b". Generally I'd expect you to see that Status'image(S) = "b", Status'pos(S) = 1, and To_Integer(S) = 20 (where To_Integer is an instatiation of unchecked_conversion between Status and Integer). -- T.E.D. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.