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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,514627f9964b6e38 X-Google-Attributes: gid103376,public From: "W. Wesley Groleau x4923" Subject: Re: Using the GNAT defined attribute: 'Enum_Rep Date: 1997/09/09 Message-ID: <3415BF12.22A5@pseserv3.fw.hac.com>#1/1 X-Deja-AN: 271136983 Sender: usenet@most.fw.hac.com (News Administration) X-Nntp-Posting-Host: sparc02 References: <97090912331704@psavax.pwfl.com> To: "Marin David Condic, 561.796.8997, M/S 731-96" Organization: Hughes Defense Communications Newsgroups: comp.lang.ada Date: 1997-09-09T00:00:00+00:00 List-Id: Marin David Condic, 561.796.8997, M/S 731-96 wrote: > >a compiler, given > > > > type Enum is (Zero, One, Two, Three, Four, Five, Six, Seven ); > > > >(with no rep-clause), please cite LRM-83 or LRM-95 if it is > >illegal for an implementation to internally use > > > > for Enum use (Zero => 2#00000001#, > > One => 2#00000010#, > > Two => 2#00000100#, > > Three => 2#00001000#, > > Four => 2#00010000#, > > Five => 2#00100000#, > > Six => 2#01000000#, > > Seven => 2#10000000# ); > I'm not sure if you ever received my original response to you on > this subject & I didn't post it to C.L.A. because I had not seen > it in the listserver output from VM1.NODAK.EDU. (Is something > wrong with this listserver? I seem to be missing out on large > chunks of the conversation, seeing things badly out of date and > not entirely sure that anything I post gets through.) No, I didn't see it. I am glad to be off of info-ada because it lost about 50% of my posts, and often gave me duplicates of other people's post many days after the first copy. What started me off on the above topic was your apparently wanting to depend on the default representation without specifying it. I was trying to suggest it may be easier to just specify the one you want (as indeed, you were trying to do for 'size). My post was followed up by first a denial of something I hadn't said, then by a correct answer followed by an explanation that contradicted it. Finally Matthew Heaney again gave the correct answer and the LRM 95 reference. Which is, for anyone confused, > ... RM95 13.4(8) states > "For nonboolean enumeration types, if the coding is not specified for the > type, then for each value of the type, the internal code shall be equal > to its position number." > > Therefore, your example is legal in Ada 83, and illegal in Ada 95. So if you know your code won't be used under Ada-83, you can depend on the default. None of this answers your original question about the 'Size, but as you already know, Bob Duff offered a good idea. I also had posted an idea using a named number, but Bob Duff's idea is probably better for most cases. -- ---------------------------------------------------------------------- Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA Senior Software Engineer - AFATDS Tool-smith Wanna-be wwgrol AT pseserv3.fw.hac.com Don't send advertisements to this domain unless asked! All disk space on fw.hac.com hosts belongs to either Hughes Defense Communications or the United States government. Using email to store YOUR advertising on them is trespassing! ----------------------------------------------------------------------