comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Fortran's Equivalence
Date: 1997/03/29
Date: 1997-03-29T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680002903971539370001@news.ni.net> (raw)
In-Reply-To: 5hbcdn$i1h@top.mitre.org


In article <5hbcdn$i1h@top.mitre.org>, mfb@mbunix.mitre.org (Michael F
Brenner) wrote:

>The requirements for poratability and speed might be opposing each other
>a little, and some balance might be required. One possible compromise is
>to use the Ada 95 SHIFT capababilities.

No.  Do not use shift - use a record with a representation clause, and
convert it using Unchecked_Conversion.  Using shift is for languages that
lack Ada's powerful abstraction features.  (Even in C you can do use a bit
field.)

>To get at a bit string, shift it
>and AND it, similar to what the FORTRAN generated code is doing in this
>case. You are right, however, that address overlays are almost always
>faster in execution time than any operation in a HOL, unless the HOL
>optimizes the operation away.

Using Unchecked_Conversion will very likely generate NO code, and it's
infinately safer than an address overlay.

People have been making claims about "HOL inefficiency" since the first
compilers came out 40 years ago.  How do you know, because greater semantic
information is available to the Ada compiler, that equivalent structures
aren't more efficient in Ada (proudly HOL) than in a lower-level language?

>The portability problem comes in because
>the Ada-95 manual did not standardize a bit numbering in the word, nor
>does it standardize a pragma to tell which bit is zero in a portable
>manner. Had it done so, then about half of all bit field applications
>would have been portable using address overlays. As it is, true
>portability (without a changing global flag telling where bit one is), is
>difficult to accomplish without using specific operations (like SHIFT),
>which have effects on performance (both speed and logically overspecified
>algorithms). 

What's wrong with the Bit_Order attribute?  Can't you use that to portably
specify record representations?

It's all very theoretically interesting about what would have allowed
portability using overlays, but since you should never use address overlays
to change representation, then such conversation is just idle speculation,
eh?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  parent reply	other threads:[~1997-03-29  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 ` Michael F Brenner
1997-03-26  0:00   ` Larry Kilgallen
1997-03-28  0:00   ` Oliver Kellogg
1997-03-29  0:00   ` Matthew Heaney [this message]
1997-03-29  0:00     ` Robert Dewar
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             ` Robert Dewar
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               ` Keith Thompson
1997-04-07  0:00               ` Charles H. Sampson
1997-04-04  0:00             ` Keith Thompson
1997-04-04  0:00               ` Robert Dewar
1997-04-08  0:00                 ` Keith Thompson
1997-04-07  0:00             ` Charles H. Sampson
1997-03-26  0:00 ` Tom Moran
1997-03-26  0:00 ` FORTRAN's Equivalence Nick Roberts
1997-03-26  0:00 ` Fortran's Equivalence 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-28  0:00 ` 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