# 14. Additional problems at the transition

• ### Removal of automatic generation of new lines at input

A problem, that can arise when moving from Fortran 77 to Fortran 90, is dependent on a usual deviation from the standard, and has to do especially with user programs. What we consider here, is the use in the FORMAT of the dollar symbol \$ in order to remove the generation of a new line (Line Feed/Carriage Return), before the user gives a new value to a variable. This is a common extension of Fortran 77, but it generates a compilation error in Fortran 90 for the dollar symbol and therefore another solution has to be found.

With many Fortran 77 implementations we wrote

PROGRAM TEST
REAL X
WRITE(*,10)
10     FORMAT('Give X = ',\$)
WRITE(*,*) X
END

In Fortran 90 we use "non-advancing I/O" instead. We therefore write the following
PROGRAM TEST
IMPLICIT NONE
REAL X
WRITE(*,*) X
END

Both those programs give the same result, you may give the value of the variable on the same row as the text "Give X = ". Non-advancing I/O can not be used with list-directed I/O or on NAMELIST.

• ### Varying system for the treatment of matrices

In Fortran 77 there is no dynamic memory allocation, you therefore have to give a sufficiently large dimension in the calling program and keep in mind the "leading dimension" in the called program unit. Now when you use Fortran 90 you prefer to have an array of the same shape and size as the logical size of a matrix. An assignment that performs this transformation is easy to achieve. We assume that a quadratic matrix from the calling program unit is available in the subprogram under consideration as the array A with the dimensions A(IA, *) and that we wish to move this to an array B with the dimension specification B(N, N), where N at the same time is the mathematical dimension of the matrix. The following assignment statement gives what you want, provided IA is not less than N.
B = A(1:N, 1:N)

• ### Differences in the use of logical variables

The new standard contains many more words and is more explicit, while some of the rules are formulated in such a way that the probability that they are obeyed by the compiler or rather the compiler writer is much greater. An example is comparison of a logical variables, which under Fortran 90 has to be done with .EQV. or .NEQV. while this in practice often was possible in Fortran 77 also with .EQ. and .NE. If you try to perform such a comparison in Fortran 90 with the new equality symbol = = you can get a confusing error message, complaining that .EQ. may not be used in this context. The reason is of course that = = is just an alternative spelling of .EQ.

• ### Small things of importance

It has been rather common to use the variable name SUM in order to store the temporary value at the summation in a DO-loop. This name is now less convenient to use, since SUM is also the name of an automatic summation, see Appendix 5, section 14 (on array functions). Other dangerous variable names can be ALL, HUGE, INDEX, INT, KIND, MASK, SCALE, SIZE, TINY and TRIM. If you use a name that is being used by the Fortran language, the normal effect is that the intrinsic function is no longer available.

In some old Fortran dialects the statement TYPE was used to write on a typewriter terminal and PRINT was used to write on the line printer. The concept TYPE now has a completely new meaning in Fortran 90, to declare user-defined data types.