next up previous contents
Next: Numeric and Logical Declarations Up: Data Objects Previous: Literal Constants

 

Implicit Typing

If a variable is referenced but not declared (in its scoping unit) then, by default, it is implicitly declared. The type that it assumes depends on the first letter,

This short cut is potentially very dangerous as a misspelling of a variable name can declare and assign to a brand new variable with the user being totally unaware.

Implicit typing should always be turned off by adding:

    IMPLICIT NONE

as the first line after any USE statements. In this way the user will be informed of any undeclared variables used in the program.

Consider,

    DO 30 I = 1.1000
     ...
 30 CONTINUE

in fixed format with implicit typing this declares a REAL variable DO30I and sets it to 1.1000 instead of performing a loop 1000 times! Legend has it that the example sighted caused the crash of the American Space Shuttle. An expensive missing comma!

Return to corresponding overview page gif


next up previous contents
Next: Numeric and Logical Declarations Up: Data Objects Previous: Literal Constants

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.