next up previous contents
Next: References Up: What language? Previous: High level languages

Fortran or C?

Today, the two more popular languages for numeric computation are Fortran and C.

Fortran has a long tradition in computational physics, chemistry and engineering. Born at the end of the 50s, during the 60s and the 70s it became the most popular choice for the development of numerically intensive code. An enormous body of knowledge has been embedded in Fortran codes.

C is a more recent language. It was developed in the 70s and provides the foundation for the Unix operating system. The popularity of Unix is a direct consequence of the fact that it is largely written in C, and therefore easily portable between different brands of computers. C is a simple still very powerful language, and its scope is rather broad: the solution to problems in very different areas has been coded in C with success.

Languages evolve much more slowly than computer architectures. The main reason for that is that we can easily upgrade to new computers: what we have to do is to recompile our programs with the compiler supplied with the new machine. Changing language is a much more expensive and painful business: we must rewrite our codes, and make sure that the new version does what it is supposed to do. However, advances in computer systems often create a need for new features in a language.

For this reason, even a stable and well-proven language such as Fortran undergoes periodic revisions in order to keep it up to date. Fortran was revised in 1966 (Fortran 66), then 1977 (Fortran 77), and more recently in 1990 (Fortran 90). At present, there is an immense amount of scientific codes written in Fortran 77. Many of them are of public domain, and among them there are libraries of subroutines for solving a large variety of problems.

Both Fortran 90 and C are perfectly valid choices for a computationally intensive application. Fortran 77 lacks many features which are crucial today, and should be regarded as an obsolescent language.

In favor of C:

In favor of Fortran 90: The final choice can be in favor of either one of them, depending to the weight assigned to the various factors.

For this writer, the advantages of Fortran 90 outweigh those of C, and the code examples in this notes are written in Fortran 90. Some will disagree with this choice.

next up previous contents
Next: References Up: What language? Previous: High level languages
Furio Ercolessi