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,8272e612db888282 X-Google-Attributes: gid103376,public From: Pascal Ledru Subject: Re: -ve values in enumeration rep clauses. Date: 1996/06/14 Message-ID: <31C1C04A.4970@MSMAIL3.HAC.COM>#1/1 X-Deja-AN: 160191495 references: <5c3p6DALoKwxEwb0@djcull.demon.co.uk> content-type: text/plain; charset=us-ascii organization: Aerospatiale, Inc mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0b4 (Macintosh; I; PPC) Date: 1996-06-14T00:00:00+00:00 List-Id: 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;