Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ckormanyos/hello_f77

The epic Hello World program in the Fortran77 language
https://github.com/ckormanyos/hello_f77

fortran fortran77 hello-world

Last synced: about 1 month ago
JSON representation

The epic Hello World program in the Fortran77 language

Awesome Lists containing this project

README

        

hello_f77
==================



Build Status


Boost Software License 1.0



hello_f77 implements the epic _Hello_ _World_ program in `FORTRAN77`.

## Compile on `*nix`

Use GCC to compile [`hello_f77.f`](./hello_f77.f). This requires the presence
of `fortran` in the enabled languages of the GCC build (see image and description below).
The `libgfortran` library must also be installed on the system for proper linking.

```sh
cd hello_f77
g++ hello_f77.f -x f77 -std=legacy -O2 -lgfortran -o hello_f77.exe
```

### Query if `fortran` Is Available

If you are unsure if `fortran` is available, query GCC for the presence of `fortran`.
Use the command shown below and search for `fortran` in the list of GCC's
_enabled_ languages.

```sh
g++ -v
```

![](./images/gcc_has_fortran.jpg)

## Source Listing

The complete source is provided below.
It can be found in [`hello_f77.f`](./hello_f77.f).

You can even try this program at the following
[short link](https://godbolt.org/z/sMoP43Mcc) to [godbolt](https://godbolt.org).

```fortran
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C Copyright Christopher Kormanyos 1985 - 2023.
C Distributed under the Boost Software License,
C Version 1.0. (See accompanying file LICENSE_1_0.txt
C or copy at http://www.boost.org/LICENSE_1_0.txt)
C

C g++ hello_f77.f -x f77 -std=legacy -O2 -lgfortran -o hello_f77.exe
C See also https://godbolt.org/z/sMoP43Mcc

PROGRAM HELLO
IMPLICIT NONE

CHARACTER*32 MY_TEXT

MY_TEXT = 'Hello World'
WRITE (*,*) MY_TEXT

END
```

## Historical Perspective

`FORTRAN` (in particular `FORTRAN77` or `f77`) was there early in the game.

From a subjective standpoint, however, it seemed like there was an intermediate
time epoch during which its support was lost, missing, or in some other
way incomplete and obscure.

Now trusty old `f77` is back. It is properly supported as part of GCC on many systems.
There is also (as there should be) conformance with legacy code.
This includes support for the $128$-bit floating-point data type `REAL*16`.

Even though `REAL*16` (and its complex counterpart `COMPLEX*32`)
are not used in _Hello_ _World_, they are available for number crunching
when needed. These high-precision types can be difficult to find in the world of
high-performance, efficient, object-code-generating programming languages.

_Even_ _today_ this makes `FORTRAN77` still a leading program
for high-performance, high-precision numerical calculations.