FORTRAN 77 Language Reference

Functions

Each intrinsic function has a specified type. An intrinsic function does not require an explicit type statement, but that is allowed. A generic function does not have a predetermined type; the type is determined by the type of the arguments, as shown in Chapter 6, Intrinsic Functions .

An external function can have its type specified in any of the following ways:

Example: Explicitly by putting its name in a type statement:


	FUNCTION F ( X ) 
	INTEGER F, X 
	F = X + 1 
	RETURN 
	END

Example: Explicitly in its FUNCTION statement:


	INTEGER FUNCTION F ( X ) 
	INTEGER X 
	F = X + 1 
	RETURN 
	END 

Example: Implicitly by its name, as with variables:


	FUNCTION NXT ( X ) 
	INTEGER X 
	NXT = X + 1 
	RETURN 
	END 

Implicit typing can affect the type of a function, either by default implicit typing or by an IMPLICIT statement. You must make the data type of the function be the same within the function subprogram as it is in the calling program unit. The f77 compiler does no type checking across program units.