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,2203a21a136b39cc X-Google-Attributes: gid103376,public From: sampson@nosc.mil (Charles H. Sampson) Subject: Re: Fortran's Equivalence Date: 1997/04/07 Message-ID: <1997Apr7.213301.26693@nosc.mil>#1/1 X-Deja-AN: 231402617 Sender: news@nosc.mil References: <333840D1.7B12@cae.ca> Organization: Computer Sciences Corporation Newsgroups: comp.lang.ada Date: 1997-04-07T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >Note incidentally one HUGE advantage of overlays over the use of >unchecked conversion, which is that if you use uncheckd conversion, >you always have to do two of them to make a modification. Consider >a case where we want an array of 32-bit integers overlaid by an >array of 32-bit floats. > >Now if you do this by declaring an array of 32-bit floats and then >doing unchecked conversion to 32-bit integer, you will end up doing > > x(J) := To_Float_32 (Fiddle (To_Integer_32 (x(J)))); > >which is MUCH more more inpenetrable than: > > x_Int (J) := Fiddle (X_Int (J)); > >Of course it is always a matter of taste whether you want to emphasize >the nature of what you are doing by writing the explicit stuff each >time. A legitimate objection to the second form here might be that >it is TOO easy to write and read! I would be one of the objectors, except that I would characterize it as not easy to read. The wordy form above says pretty clearly what's going on: Take the bits that make up the value of x(j), treat them as a 32-bit integer, fiddle with the result, treat those bits as a floating- point value, and assign them to x(j). None of that information is imme- diately available in the shorted version. It lacks an attribute that I call "local understandability". Charlie