Why Fortran?
The name Fortran is derived from the words "Formula Translation" and Fortran, along with C/C++, is commonly used in performance-oriented HPC applications. Fortran is easy to learn and provides efficient constructs that are useful for numerical calculations. The Fortran language supports object-oriented programming models like C++, though Fortran code is most often written in an imperative style rather than in functional or object-oriented style (cf. Wikipedia: Functional Programming). Still, the latest standard (F18) includes full object-oriented capability on a par with C++.
It's true that way back in the days of punch cards, FORTRAN source code was written in "fixed format", in which the first 5 columns were used for labels, column 6 indicated a continuation line, and actual code started in column 7. This legacy format is still supported, although most new code is written in free format similar to C, bash, Perl, etc. All examples in this roadmap are in the new style.
Furthermore, modern Fortran (starting with F90) provides all the constructs that C users are accustomed to—although perhaps interfacing with the Operating System (OS) is not quite as flexible. On the plus side, language elements that are of great importance for numerical computing are included, and these constructs are either different or non-existent in C.
Here is a short list of the major differences with C:
- Standard libraries integrated: No specific libraries have to be loaded explicitly for I/O and math.
- Implicit type declaration: In Fortran, variables of type real and integer may be declared implicitly, based on their first letter. This behavior can be turned off ("implicit none"); this is recommended for novice Fortran users. However, in legacy code and code written by experienced Fortran programmers, this intrinsic behavior is frequently employed.
- Arrays vs. pointers: In Fortran the distinction between variables (arrays) and pointers is blurred: all variables are references to memory addresses. As a result, multi-dimension arrays are naturally supported (arrays in C are one-dimensional) and therefore it is not necessary to construct an array of pointers to the rows within a matrix, as in C. The use of arrays is common in Fortran, but pointers are supported as well.
- Call by reference: This is the other reason why pointers are not commonly used in Fortran. Parameters in function and subroutine calls are all passed by reference. The address of a variable (array) is passed, but not treated like a mere address; it is considered as equivalent to the variable (array) itself, so operations on the argument modify the value(s) of the actual variable (array) in memory. Therefore there is no reason for referencing and de-referencing of addresses (as commonly seen in C). This is much more convenient in numerical code because in these codes the values of variables are manipulated and not their addresses.