From: Pascal Ledru <Ledru#m#_Pascal@MSMAIL3.HAC.COM>
Subject: Re: -ve values in enumeration rep clauses.
Date: 1996/06/14
Date: 1996-06-14T00:00:00+00:00 [thread overview]
Message-ID: <31C1C04A.4970@MSMAIL3.HAC.COM> (raw)
In-Reply-To: 5c3p6DALoKwxEwb0@djcull.demon.co.uk
Obviously the range of your byte type should include negative values:
with Unchecked_Conversion;
with Text_IO;
procedure X is
type A_Type is (A,B,C);
for A_Type use
( A => -3,
B => -2,
C => -1 );
for A_Type'Size use 8;
--type Byte is new Integer range 0 .. 255;
type Byte is new Integer range -126 .. 127;
for Byte'Size use 8;
function Convert is new Unchecked_Conversion
( Source => A_Type,
Target => Byte );
begin
Text_IO.Put_Line(Byte'Image( ( Convert(A) );
end;
next prev parent reply other threads:[~1996-06-14 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-14 0:00 -ve values in enumeration rep clauses Darel Cullen
1996-06-14 0:00 ` Pascal Ledru [this message]
1996-06-14 0:00 ` Adam Beneschan
1996-06-14 0:00 ` James Rhodes
1996-06-15 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox