comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau x4923" <wwgrol@pseserv3.fw.hac.com>
To: "Marin David Condic, 561.796.8997, M/S 731-96" <condicma@PWFL.COM>
Subject: Re: Using the GNAT defined attribute: 'Enum_Rep
Date: 1997/09/09
Date: 1997-09-09T00:00:00+00:00	[thread overview]
Message-ID: <3415BF12.22A5@pseserv3.fw.hac.com> (raw)
In-Reply-To: 97090912331704@psavax.pwfl.com



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!
----------------------------------------------------------------------




  reply	other threads:[~1997-09-09  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Using the GNAT defined attribute: 'Enum_Rep Marin David Condic, 561.796.8997, M/S 731-96
1997-09-09  0:00 ` W. Wesley Groleau x4923 [this message]
1997-09-11  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-09-09  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-09-09  0:00 ` Robert A Duff
1997-08-27  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-09-03  0:00 ` W. Wesley Groleau x4923
1997-09-06  0:00   ` Robert Dewar
1997-09-08  0:00     ` Robert A Duff
1997-09-08  0:00     ` W. Wesley Groleau x4923
1997-09-08  0:00       ` Matthew Heaney
1997-09-08  0:00   ` Robert A Duff
1997-09-08  0:00     ` W. Wesley Groleau x4923
1997-09-08  0:00       ` Matthew Heaney
1997-09-09  0:00         ` Robert A Duff
1997-09-11  0:00           ` Robert Dewar
1997-09-08  0:00 ` Robert A Duff
replies disabled

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