Default Fortran Variable Types


Many of us who have used Fortran for many years, tend not to use the IMPLICIT NONE statement, relying on the fact, that without this statement, Fortran assumes any variable beginning with letters i-n or I-N are INTEGER, and those beginning with any other letter are REAL. This is a very dangerous practice unless compiler options or other tools are used to locate "undefined variables". An "undefined variable" is one used on the right of an assignment statement, but never assigned a value in a preceding assignment statement, subprogram reference, DATA, or PARAMETER statement. It is often simply the result of a typographic error, and easily detected by using IMPLICIT NONE. However, IMPLICIT doesn't cover all possible programming goofs. The use of compiler cross-reference listings and indexing tools is a good idea as you get into more serious applications. Another good protection available in Fortran 90, is the combination of the INTERFACE statement and INTENT attribute for data types.

Having conceded the value of IMPLICIT NONE and the associated REAL or INTEGER statements for all variables, I still prefer to follow the old naming conventions whenever practical. In large programs, having to search all REAL and INTEGER statements to check the type of a given variable, is a major nuisance. The ability to identify a variable's type immediately by its first letter is a major convenience, when reviewing an old code (yours or somebody else's).