next up previous contents index
Next: Statement Functions Up: Procedures Previous: Procedures

Intrinsic Functions

 

Intrinsic functions have a number of unique properties. The data type of each intrinsic function is known to the Fortran system and is not subject to the normal rules. IMPLICIT and type statements alone have no effect on them. Some intrinsic functions have generic names: when these are used the compiler selects the appropriate specific function according to the data type of the arguments.

A few intrinsic functions such as MAX, MIN, and CMPLX, are allowed to have a variable number of arguments, but all of the arguments must have the same data type. User-written procedures cannot have optional arguments or generic type.

Although intrinsic functions can be used in any program unit, their names are not global, nor are they reserved words. It is, however, best to avoid choosing a name for a variable or array which is identical to that of an intrinsic function. It may cause confusion and in the long run it may make it more difficult to enhance the program. A name clash is more serious if it involves an external function or subroutine, for in this case the external procedure name must be specified in an EXTERNAL statement to resolve the ambiguity. By this means it is possible to substitute an external function of your own for one of the intrinsic functions.

The Fortran Standard specifies a fairly extensive set of intrinsic functions which must always be available but it does not prevent the provision of additional ones. Many systems provide additional intrinsic functions which, for example, obtain the current date and time, generate pseudo-random numbers, or evaluate Gaussian probability. The main drawback in using non-standard functions is that you may have to find a substitute if your program is moved to another system which does not have the same extensions.

The standard intrinsic functions for the arithmetic types are described in detail in section 6.2; those used with character-strings are covered in section 7.5. A complete alphabetical list is provided in the appendix.


next up previous contents index
Next: Statement Functions Up: Procedures Previous: Procedures

Mario Storti
Wed Nov 4 19:32:56 ART 1998