comp.lang.ada
 help / color / mirror / Atom feed
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.211458.26224@nosc.mil> (raw)
In-Reply-To: E8385t.9zE@thomsoft.com


In article <E8385t.9zE@thomsoft.com>, Keith Thompson <kst@sd.aonix.com> wrote:
> 
>2. If you're using overlays, watch out for default initializations.
>   For example, if a record type has default initial values for some
>   or all of its components, an address clause does not inhibit the
>   initialization unless the object is imported.  The same area of memory
>   could be initialized twice if you're not careful.
> 
     From something I've recently learned in another thread, I gather 
that such a program would be erroneous according to 13.3(13).  Appar-
ently it's o. k. to interpret the initializations as making the address 
invalid.

>3. If you're translating Fortran code to Ada (let's not get into
>   whether this is a good idea), and the Fortran uses EQUIVALENCE, you
>   should determine just how it's being used.  If the closest semantic
>   match to the particular usage of the EQUIVALENCE happens to be
>   Unchecked_Conversion, use Unchecked_Conversion.  This requires some
>   thought and analysis, which is why automated translation from one high
>   level language to another is impractical given the current state of
>   the art.
> 
>Just saying that a Fortran EQUIVALENCE should be translated into an Ada
>overlay misses some very important points.
> 
     Bless you, Keith.  This is very close to a point I've been trying 
to make in the CMS-2 world for years.  If you want to translate an over-
lay into Ada it's necessary to understand how the overlay is being used.  
The CMS-2 to Ada translator that I was responsible for was very conser-
vative; it refused to translate overlays at all, calling for user inter-
vention.  Unfortunately, users of CMS-2 translators want the translator 
to handle overlays.  They're all over the place and typically very dif-
ficult to figure out.  The result was that our translator would regu-
larly lose out to others that claimed to translate overlays by one or 
another simplistic approach.

     If development money had held out we intended to detect some com-
mon cases that were translatable.  And if cows had wings ...

				Charlie




  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 ` 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-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             ` Robert Dewar
1997-04-07  0:00               ` Keith Thompson
1997-04-07  0:00               ` Charles H. Sampson
1997-04-07  0:00               ` Viqar Abbasi
1997-04-08  0:00                 ` Charles H. Sampson
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-08  0:00                   ` Robert Dewar
     [not found]                     ` <1997Apr15.163103.27481@nosc.mil>
1997-04-16  0:00                       ` Robert Dewar
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 [this message]
1997-03-29  0:00     ` Robert Dewar
1997-03-26  0:00 ` Tom Moran
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