# 1.4 Fortran 90 Features

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.

## New Features

The following Fortran 90 features are new to Fortran:

- Free source form

  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.

- Modules

  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.

- User-defined (derived) data types and operators

  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.

  For more information, see Sections 3.2 and 8.9.4.

- Array operations and features

  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).

  For more information, see Section 3.4.2 and Chapter 9.

- Generic user-defined procedures

  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.

- Pointers

  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.

  For more information, see Sections 5.15 and 4.2.3.

- Recursion

  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.

- Interface blocks

  A Fortran 90 procedure can contain an interface block. Interface blocks can be used to do the following:

  - Describe the characteristics of an external or dummy procedure
  - Define a generic name for a procedure
  - Define a new operator (or extend an intrinsic operator)
  - Define a new form of assignment

  For more information, see Section 8.9.

- Extensibility and redundancy

  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.

## Improved Features

The following Fortran 90 features improve previous Fortran features:

- Additional features for source text

  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.

- Improved facilities for numerical computation

  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.

  For more information, see Chapters 3 and 9.

- Optional procedure arguments

  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.

- Additional input/output features

  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).

- Additional control constructs

  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.

- Additional intrinsic procedures

  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.

- Additional specification statements

  The following specification statements are new in Fortran 90:

  - The INTENT statement (Section 5.10)
  - The OPTIONAL statement (Section 5.13)
  - The Fortran 90 POINTER statement (Section 5.15)
  - The PUBLIC and PRIVATE statements (Section 5.16)
  - The TARGET statement (Section 5.18)
- Additional way to specify attributes

  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.

- Scope and Association

  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.

Previous Page Next Page Table of Contents