1.5.9 EXTERNAL and INTRINSIC Statements

An EXTERNAL statement declares that the specified function name is an external function, and an INTRINSIC statement declares that the specified function is an intrinsic (built-in) function. They are necessary when using function names as  actual arguments, but they have other important aspects as well.

Intrinsic functions such as sin and cos must be provided in advance by the implementation of the FORTRAN standard, but the FORTRAN standard allows implementations to provide functions that are not intrinsic to the FORTRAN standard. Therefore, implementations normally have more intrinsic functions that those defined by the FORTRAN standard. Needless to say, the names of the extended intrinsic functions are totally different for different implementations. In other words, a function name that does not exist in the FORTRAN standard and is not declared by either the EXTERNAL or INTRINSIC statement may be treated as either and intrinsic or external function depending on the implementation used.

For example, if you define an external function and the name happens to be identical to an intrinsic function of the implementation, later reference to the function may call the function provided by the implementation and not the function defined by the user. Since a function name is limited to less than 6 characters and there is a limit to the variations of ideas for names, such conditions are more common than some would expect. However, when a program runs away due to this trouble, it is rather difficult to determine the cause, because the program written by the user is correct.

In order to write a program that is not implementation-dependent, it is best to specify all external functions for each program unit using the EXTERNAL statement. Furthermore, when inquiring about implementation-specific functions that does not exist in the FORTRAN standard, they should be specified using the INTRINSIC statement.

Of course, all functions provided by the DCL are "external functions." To the implementation, all of the programs in DCL are "user programs," and they are not to be mistaken as intrinsic functions simply because they have been provided for you.