Re: Fortran to C/C++ translation: a running example.

gah4 <gah4@u.washington.edu>
Sat, 21 May 2022 09:31:45 -0700 (PDT)

          From comp.compilers

Related articles
Fortran to C/C++ translation: a running example. rockbrentwood@gmail.com (Rock Brentwood) (2022-05-16)
Re: Fortran to C/C++ translation: a running example. tkoenig@netcologne.de (Thomas Koenig) (2022-05-17)
Re: Fortran to C/C++ translation: a running example. lydiamariewilliamson@gmail.com (Lydia Marie Williamson) (2022-05-20)
Re: Fortran to C/C++ translation: a running example. gah4@u.washington.edu (gah4) (2022-05-21)
Re: Fortran to C/C++ translation: a running example. tkoenig@netcologne.de (Thomas Koenig) (2022-05-21)
| List of all articles for this month |

From: gah4 <gah4@u.washington.edu>
Newsgroups: comp.compilers
Date: Sat, 21 May 2022 09:31:45 -0700 (PDT)
Organization: Compilers Central
References: 22-05-032 22-05-038
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="61175"; mail-complaints-to="abuse@iecc.com"
Keywords: Fortran
Posted-Date: 21 May 2022 13:25:58 EDT
In-Reply-To: 22-05-038

On Saturday, May 21, 2022 at 8:54:47 AM UTC-7, Lydia Marie Williamson wrote:


(snip on COMMON and EQUIVALENCE)


> This is not exactly correct. It's "common blocks" that were handled in this
> way.


> In the Fortran source of Zork/dungeon, the "equivalence" statements and
> "common blocks" were used together, so it's easy to get the issue confused. I
> don't know if their being used together is something that always happened in
> Fortran, or if it was just particular to this program.


COMMON and EQUIVALENCE are closely related in the Fortran standard,
and in the implementation by compilers. A variable equivalenced to a
variable in common, is also in common. Such variable can extend the
length of the common block, but only at the end, not the beginning.


It used to be that compilers would print out a variable map, with the
address, or offset, of each variable, and its length and type. That was
often useful to be sure that the compiler did what you thought it did.
Also, it would include the length of each common block, again good
to check to be sure they agree with what you expect.


The Fortran standard has a C interoperability feature that explains
how Fortran features and C features work together.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.