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: Robert Dewar Subject: Re: Enumeration representation Date: 1999/09/10 Message-ID: <7rbvna$25q$1@nnrp1.deja.com>#1/1 X-Deja-AN: 523525213 References: <37D8E3BC.175DB72C@newtech.it> <7rb8c3$fql$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x21.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Fri Sep 10 22:12:03 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-09-10T00:00:00+00:00 List-Id: In article <7rb8c3$fql$1@nnrp1.deja.com>, Ted Dennison wrote: > 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". Ted, you missed the Discard_Names!!! > > 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. > Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.