This section briefly describes the Fortran 90 language features that have been implemented in Compaq Fortran. Some features are new, while others are improvements to previous Fortran features.
The following Fortran 90 features are new to Fortran:
Fortran 90 provides a new free source form where line positions
have no special meaning. There are no reserved columns, trailing
comments can appear, and blanks have significance under certain
circumstances (for example, P R O G R A M
is not
allowed as an alternative for PROGRAM
).
For more information, see Section 2.3.1.
Fortran 90 provides a new form of program unit called a module, which is more powerful than (and overcomes limitations of) FORTRAN 77 block data program units.
A module is a set of declarations that are grouped together under a single, global name. Modules let you encapsulate a set of related items such as data, procedures, and procedure interfaces, and make them available to another program unit.
Module items can be made private to limit accessibility, provide data abstraction, and to create more secure and portable programs.
For more information, see Section 8.3.
Fortran 90 lets you define new data types derived from any combination of the intrinsic data types and derived types. The derived-type object can be accessed as a whole, or its individual components can be accessed directly.
You can extend the intrinsic operators (such as + and *) to user- defined data types, and also define new operators for operands of any type.
In Fortran 90, intrinsic operators and intrinsic functions can operate on array-valued operands (whole arrays or array sections).
New features for arrays include whole, partial, and masked array assignment (including the WHERE statement for selective assignment), and array-valued constants and expressions. You can create user-defined array-valued functions, use array constructors to specify values of a one-dimensional array, and allocate arrays dynamically (using ALLOCATABLE and POINTER attributes).
New intrinsic procedures create multidimensional arrays, manipulate arrays, perform operations on arrays, and support computations involving arrays (for example, SUM sums the elements of an array).
In Fortran 90, user-defined procedures can be placed in generic interface blocks. This allows the procedures to be referenced using the generic name of the block.
Selection of a specific procedure within the block is based on the properties of the argument, the same way as specific intrinsic functions are selected based on the properties of the argument when generic intrinsic function names are used.
For more information, see Section 8.9.3.
Fortran 90 pointers are mechanisms that allow dynamic access and processing of data. They allow arrays to be sized dynamically and they allow structures to be linked together.
A pointer can be of any intrinsic or derived type. When a pointer is associated with a target, it can appear in most expressions and assignments.
Fortran 90 procedures can be recursive if the keyword RECURSIVE is specified on the FUNCTION or SUBROUTINE statement line.
For more information, see Chapter 8.
A Fortran 90 procedure can contain an interface block. Interface blocks can be used to do the following:
For more information, see Section 8.9.
By using user-defined data types, operators, and meanings, you can extend Fortran to suit your needs. These new data types and their operations can be packaged in modules, which can be used by one or more program units to provide data abstraction.
With the addition of new features and capabilities, some old features become redundant and may eventually be removed from the language. For example, the functionality of the ASSIGN and assigned GO TO statements can be replaced more effectively by internal procedures. The use of certain old features of Fortran can result in less than optimal performance on newer hardware architectures.
For more information, see your user manual or programmer's guide. For a list of obsolescent features, see Appendix A.
The following Fortran 90 features improve previous Fortran features:
Lowercase characters are now allowed in source text. A semicolon can be used to separate multiple statements on a single source line. Additional characters have been added to the Fortran character set, and names can have up to 31 characters (including underscores).
For more information, see Chapter 2.
Intrinsic data types can be specified in a portable way by using a kind type parameter indicating the precision or accuracy required. There are also new intrinsic functions that allow you to specify numeric precision and inquire about precision characteristics available on a processor.
Procedure arguments can be made optional and keywords can be used when calling procedures, allowing arguments to be listed in any order.
For more information, see Chapter 8.
Fortran 90 provides additional keywords for the OPEN and INQUIRE statements. It also permits namelist formatting, and nonadvancing (stream) character-oriented input and output.
For more information on formatting, see Chapter 10; on OPEN and INQUIRE, see Chapter 12 (for details on OpenVMS systems) or Chapter 13 (for details on Tru64 UNIX, Linux, and Windows systems).
Fortran 90 provides a new control construct (CASE) and improves the DO construct. The DO construct can now use CYCLE and EXIT statements, and can have additional (or no) control clauses (for example, WHILE). All control constructs (CASE, DO, and IF) can now be named.
For more information, see Chapter 7.
Fortran 90 provides many more intrinsic procedures than existed in FORTRAN 77. Many of these new intrinsics support mathematical operations on arrays, including the construction and transformation of arrays. New bit manipulation and numerical accuracy intrinsics have been added.
For more information, see Chapter 9.
The following specification statements are new in Fortran 90:
Fortran 90 lets you specify attributes (such as PARAMETER, SAVE, and INTRINSIC) in type declaration statements, as well as in specification statements.
For more information, see Section 5.1.
These concepts were implicit in FORTRAN 77, but they are explicitly defined in Fortran 90. In FORTRAN 77, the term scoping unit applies to a program unit, but Fortran 90 expands the term to include internal procedures, interface blocks, and derived-type definitions.
For more information, see Chapter 16.