From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Ada Enumerations
Date: 1997/12/07
Date: 1997-12-07T00:00:00+00:00 [thread overview]
Message-ID: <mheaney-ya023680000712972309100001@news.ni.net> (raw)
In-Reply-To: 881531533.459982@wagasa.cts.com
In article <881531533.459982@wagasa.cts.com>, kst@king.cts.com (Keith
Thompson) wrote:
>There are some partial solutions for these problems. Unchecked_Conversion
>can be used to query the representation; the problem is determining an
>integer type that matches a given enumeration type, especially if the
>representation includes negative values.
Why is this a problem? If you specify a representation, then you probably
specified a size too, because you're transferring the data to an external
device. So why not declare an instantiation of Unchecked_Conversion at the
point of declaration of the enumeration type?
type Color is (Red, Green, Blue);
for Color use (Red => -2, Green => 5, Blue => 10);
for Color'Size use 8;
type Color_Rep is new Interfaces.Integer_8;
function To_Rep is new Unchecked_Conversion (Color, Color_Rep);
What's the problem?
--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271
next prev parent reply other threads:[~1997-12-07 0:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-03 0:00 Ada Enumerations Jeffrey Harris
1997-12-03 0:00 ` James S. Rogers
1997-12-03 0:00 ` Robert Dewar
1997-12-03 0:00 ` Stanley R. Allen
1997-12-04 0:00 ` GNAT'Object_Size Mats Weber
1997-12-04 0:00 ` GNAT'Object_Size Mats Weber
1997-12-04 0:00 ` Ada Enumerations Robert Dewar
1997-12-04 0:00 ` Stanley R. Allen
1997-12-18 0:00 ` Wes Groleau
1997-12-04 0:00 ` Matthew Heaney
1997-12-04 0:00 ` Stanley R. Allen
1997-12-07 0:00 ` Keith Thompson
1997-12-07 0:00 ` Matthew Heaney [this message]
1997-12-07 0:00 ` Robert Dewar
1997-12-08 0:00 ` Keith Thompson
1997-12-07 0:00 ` Matthew Heaney
1997-12-11 0:00 ` John G. Volan
1997-12-04 0:00 ` GNAT'Object_Size Mats Weber
1997-12-05 0:00 ` GNAT'Object_Size Mats Weber
1997-12-04 0:00 ` GNAT'Object_Size Mats Weber
1997-12-04 0:00 ` GNAT'Object_Size Mats Weber
1997-12-08 0:00 ` GNAT'Object_Size Mats Weber
1997-12-10 0:00 ` GNAT'Object_Size Robert Dewar
1997-12-04 0:00 ` Ada Enumerations Stephen Leake
1997-12-04 0:00 ` Matthew Heaney
1997-12-04 0:00 ` Robert Dewar
1997-12-06 0:00 ` Jean-Pierre Rosen
1997-12-06 0:00 ` Making Predefined Operators Abstract Matthew Heaney
-- strict thread matches above, loose matches on Subject: below --
1997-12-10 0:00 Ada enumerations Stanley R. Allen
1997-12-10 0:00 ` Robert Dewar
1997-12-11 0:00 ` Stanley R. Allen
1997-12-12 0:00 ` Robert Dewar
1997-12-11 0:00 ` Mats Weber
1997-12-11 0:00 ` Robert Dewar
1997-12-12 0:00 ` Mats Weber
1997-12-12 0:00 ` Robert Dewar
1997-12-12 0:00 ` Samuel T. Harris
1997-12-10 0:00 ` John M. Mills
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox