From: sampson@nosc.mil (Charles H. Sampson)
Subject: Re: Fortran's Equivalence
Date: 1997/04/07
Date: 1997-04-07T00:00:00+00:00 [thread overview]
Message-ID: <1997Apr7.213301.26693@nosc.mil> (raw)
In-Reply-To: dewar.860159911@merv
In article <dewar.860159911@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> 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
next prev parent reply other threads:[~1997-04-07 0:00 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-25 0:00 Fortran's Equivalence Viqar Abbasi
1997-03-26 0:00 ` Tom Moran
1997-03-26 0:00 ` Michael F Brenner
1997-03-26 0:00 ` Larry Kilgallen
1997-03-28 0:00 ` Oliver Kellogg
1997-03-29 0:00 ` Matthew Heaney
1997-03-29 0:00 ` Robert Dewar
1997-04-01 0:00 ` Keith Thompson
1997-04-01 0:00 ` Robert Dewar
1997-04-01 0:00 ` Robert A Duff
1997-04-01 0:00 ` Robert Dewar
1997-04-04 0:00 ` Keith Thompson
1997-04-04 0:00 ` Keith Thompson
1997-04-04 0:00 ` Robert Dewar
1997-04-08 0:00 ` Keith Thompson
1997-04-04 0:00 ` Robert Dewar
1997-04-07 0:00 ` Charles H. Sampson [this message]
1997-04-07 0:00 ` Keith Thompson
1997-04-07 0:00 ` Viqar Abbasi
1997-04-08 0:00 ` Charles H. Sampson
1997-04-08 0:00 ` Robert Dewar
[not found] ` <1997Apr15.163103.27481@nosc.mil>
1997-04-16 0:00 ` Robert Dewar
1997-04-08 0:00 ` Matthew Heaney
1997-04-09 0:00 ` Stephen Leake
1997-04-09 0:00 ` Robert Dewar
1997-04-10 0:00 ` Simon Wright
1997-04-10 0:00 ` Robert Dewar
1997-04-07 0:00 ` Charles H. Sampson
1997-03-29 0:00 ` Robert Dewar
1997-03-26 0:00 ` Robert Dewar
1997-03-26 0:00 ` Robert A Duff
1997-03-29 0:00 ` Matthew Heaney
1997-03-29 0:00 ` Robert Dewar
1997-04-02 0:00 ` JP Thornley
1997-03-26 0:00 ` FORTRAN's Equivalence Nick Roberts
1997-03-28 0:00 ` Fortran's Equivalence Charles H. Sampson
1997-03-29 0:00 ` Matthew Heaney
1997-04-01 0:00 ` Charles H. Sampson
1997-03-29 0:00 ` Matthew Heaney
1997-03-29 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