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,45a9122ddf5fcf5 X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Rules for Representation of Subtypes Date: 1996/10/11 Message-ID: <325E5259.6D3E@lmtas.lmco.com>#1/1 X-Deja-AN: 188925368 references: <9610101740.AA09737@most> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Tactical Aircraft Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.02 (Macintosh; I; 68K) Date: 1996-10-11T00:00:00+00:00 List-Id: W. Wesley Groleau (Wes) wrote: > [snip] > I haven't used Verdix in 18 months, but if I remember right, it allowed > source to be larger than target WITH a warning. Similar memory for > VAX Ada, though I haven't used that in five years. Unfortunately, many > coders suppress warnings because "there are so @$#^$%^*&$ many of them, > they just hide the real problems." DEC Ada v3.2 still permits dissimilar sizes. Here's the code I tried: with Unchecked_Conversion; package UC_Pkg is type S_Type is range 0 .. 16#7FFF_FFFF#; for S_Type'Size use 32; type T_Type is range 0 .. 10; for T_Type'Size use 4; function S_to_T is new Unchecked_Conversion (S_Type, T_Type); S : S_Type := 16#FFFF#; T : T_Type; end; with UC_Pkg; use UC_Pkg; with Text_IO; procedure UC is begin T := S_to_T(S); -- examining T in the DEC debugger after this statement -- shows T to be equal to 16#F#. Text_IO.Put_Line(T_Type'Image(T)); -- prints "-1" (16#F# as two's complement) end; In Ada 83, there's an AI that permits the unchecked conversion to be rejected, but it's not required. > > --------------------------------------------------------------------------- > W. Wesley Groleau (Wes) Office: 219-429-4923 > Hughes Defense Communications (MS 10-40) Home: 219-471-7206 > Fort Wayne, IN 46808 (Unix): wwgrol@pseserv3.fw.hac.com > --------------------------------------------------------------------------- -- LMTAS - "Our Brand Means Quality" For more info, see http://www.lmtas.com or http://www.lmco.com