Fortran 90 adds a wealth of new features to FORTRAN 77. Fortran 90 may offer an improved method or feature above FORTRAN 77 for performing a given task. The following topics outline some of the key features that Fortran 90 brings to the FORTRAN 77 language.
In addition to the fixed source form format (defined in FORTRAN 77), Fortran 90 defines a free source form format. A statement can begin in any column, and blanks are significant.
See Free Source Form for more information.
Although the length specification for a data type (for example, INTEGER*4) is a common industry extension, Fortran 90 provides facilities for specifying the precision and range of noncharacter intrinsic data types and the character sets available for the character data type. When used with the SELECTED_INT_KIND and SELECTED_REAL_KIND intrinsic functions, data types that use parameters become portable across platforms.
See Type Parameters and Specifiers for more information.
A derived type is a user-defined type with components of intrinsic type and/or other derived types. Objects of a derived type can be used in intrinsic assignment, in input/output, and as procedure arguments. When used with defined or extended intrinsic operations, derived types can be used to provide powerful data abstractions (for example, linked lists).
See Derived Types for more information.
With Fortran 90, you can specify array expressions and assignments. An array section, a portion of a whole array, can be used as an array. Array constructors offer a concise syntax for specifying the values of an array. Assumed-shape arrays, deferred-shape arrays, and automatic arrays give you more flexibility when you use arrays. Use the WHERE construct to mask array expression evaluation and array assignment.
See Chapter 4, Array Concepts for more information.
Pointers refer to memory addresses instead of values. Pointers provide the means for creating linked lists and dynamic arrays. Objects of an intrinsic or a derived-type can be declared to be pointers.
See Pointer Association and POINTER (Fortran 90) for more information.
Storage is not set aside for pointer targets and allocatable arrays at compile time. The ALLOCATE and DEALLOCATE statements let you control the storage usage at run time. You can also use pointer assignment to alter the storage space associated with the pointer.
See ALLOCATE, DEALLOCATE, and Pointer Assignment for more information.
The CASE construct provides a concise syntax for selecting, at most, one of a number of statement blocks for execution. The case expression of each CASE block is evaluated against that of the construct.
The DO statement with no control clause and the DO WHILE construct offer increased versatility. In addition, the CYCLE and EXIT statements provide control over the execution of the construct from within the construct.
Control constructs can be given names, which aids readability and syntax-checking for nested constructs.
See Chapter 6, Control for more information.
Fortran 90 introduces many new features that make the use of procedures easier. Functions can extend intrinsic operators and define new operators. With subroutines, you can extend intrinsic assignments. The actual arguments of a procedure can be specified with keywords, and you can explicitly indicate the intended use of dummy arguments and whether or not they are optional.
The interface or characteristics of a dummy or external procedure can be explicitly specified in an interface block. A generic interface block can specify a name that can be referenced to access any specific procedures defined within the block, depending on the nature of the actual arguments.
Internal procedures, contained within a main program or another subprogram, let you partition programs while allowing you to access entities defined in the host procedure.
Recursive procedures are allowed in Fortran 90; functions and subroutines can call themselves directly or indirectly.
See Chapter 7, Program Units and Procedures for more information.
Modules provide the means for data encapsulation and the operations that apply to the data. A module is a nonexecutable program unit that can contain data object declarations, derived-type definitions, procedures, and procedure interfaces. With modules, you can specify that some entities can be used only within the module, and other entities can be accessed from any program unit.
See Modules for more information.
Fortran 90 brings dozens of new intrinsic procedures to Fortran. For example, a set of transformational intrinsic procedures provides powerful array manipulation capabilities. Many new inquiry functions enable you to examine the properties of entities.
See Chapter 12, Intrinsic Procedures for details.