# 1.3 Fortran 95 Features

This section briefly describes the Fortran 95 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 95 features are new to Fortran:

- The FORALL statement and construct

  In Fortran 90, you could build array values element-by-element by using array constructors and the RESHAPE and SPREAD intrinsics. The Fortran 95 FORALL statement and construct offer an alternative method.

  FORALL allows array elements, array sections, character substrings, or pointer targets to be explicitly specified as a function of the element subscripts. A FORALL construct allows several array assignments to share the same element subscript control.

  FORALL is a generalization of WHERE. They both allow masked array assignment, but FORALL uses element subscripts, while WHERE uses the whole array.

  Compaq Fortran previously provided the FORALL statement and construct as language extensions.

  For more information, see Sections 1.5 and 4.2.5.

- PURE user-defined procedures

  Pure user-defined procedures do not have side effects, such as changing the value of a variable in a common block. To specify a pure procedure, use the PURE prefix in the function or subroutine statement. Pure functions are allowed in specification statements.

  Compaq Fortran previously provided pure procedures as a language extension.

  For more information, see Sections 1.5 and 8.5.1.2.

- ELEMENTAL user-defined procedures

  An elemental user-defined procedure is a restricted form of pure procedure. An elemental procedure can be passed an array, which is acted upon one element at a time. To specify an elemental procedure, use the ELEMENTAL prefix in the function or subroutine statement.

  For more information, see Sections 8.5.2 and 8.5.3.

- CPU_TIME intrinsic subroutine

  This new intrinsic subroutine returns a processor-dependent approximation of processor time.

  For more information, see Section 9.3.33.

- NULL intrinsic function

  In Fortran 90, there was no way to assign a null value to the pointer by using a pointer assignment operation. A Fortran 90 pointer had to be explicitly allocated, nullified, or associated with a target during execution before association status could be determined.

  Fortran 95 provides the NULL intrinsic function that can be used to nullify a pointer.

  For more information, see Section 9.3.111.

- New obsolescent features

  Fortran 95 deletes several language features that were obsolescent in Fortran 90, and identifies new obsolescent features.

  Compaq Fortran fully supports features deleted in Fortran 95.

  For more information, see Appendix A.

## Improved Features

The following Fortran 95 features improve previous Fortran features:

- Derived-type structure default initialization

  In derived-type definitions, you can now specify default initial values for derived-type components.

  For more information, see Section 3.2.2.

- Pointer initialization

  In Fortran 90, there was no way to define the initial value of a pointer. You can now specify default initialization for a pointer.

  For more information, see Sections 3.2.1 and 3.2.2.

- Automatic deallocation of allocatable arrays

  Allocatable arrays whose status is allocated upon routine exit are now automatically deallocated.

  Compaq Fortran previously provided this feature.

  For more information, see Section 6.1.1.

- Enhanced CEILING and FLOOR intrinsic functions

  KIND can now be specified for these intrinsic functions.

  For more information, see Sections 9.3.23 and 9.3.52.

- Enhanced MAXLOC and MINLOC intrinsic functions

  DIM can now be specified for these intrinsic functions. Compaq Fortran previously provided this feature as a language extension.

  For more information, see Sections 9.3.96 and 9.3.101.

- Enhanced SIGN intrinsic function

  When a specific compiler option is specified, the SIGN function can now distinguish between positive and negative zero if the processor is capable of doing so.

  For more information, see Section 9.3.142.

- Printing of -0.0

  When a specific compiler option is specified, a floating-point value of minus zero (-0.0) can now be printed if the processor can represent it.

- Enhanced WHERE construct

  The WHERE construct has been improved to allow nested WHERE constructs and a masked ELSEWHERE statement. WHERE constructs can now be named.

  For more information, see Section 4.2.4.

- Generic identifier allowed in END INTERFACE statement

  The END INTERFACE statement of an interface block defining a generic routine now can specify a generic identifier.

  For more information, see Section 8.9.2.

- Zero-length formats

  On output, when using I, B, O, Z, and F edit descriptors, the specified value of the field width can be zero. In such cases, the compiler selects the smallest possible positive actual field width that does not result in the field being filled with asterisks (*).

- Comments allowed in namelist input

  Fortran 95 allows comments (beginning with !) in namelist input data. Compaq Fortran previously provided this feature as a language extension.

Previous Page Next Page Table of Contents