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.
The following Fortran 95 features are new to Fortran:
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.
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.
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.
This new intrinsic subroutine returns a processor-dependent approximation of processor time.
For more information, see Section 9.3.33.
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.
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.
The following Fortran 95 features improve previous Fortran features:
In derived-type definitions, you can now specify default initial values for derived-type components.
For more information, see Section 3.2.2.
In Fortran 90, there was no way to define the initial value of a pointer. You can now specify default initialization for a pointer.
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.
KIND can now be specified for these intrinsic functions.
DIM can now be specified for these intrinsic functions. Compaq Fortran previously provided this feature as a language extension.
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.
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.
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.
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.
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 (*).
Fortran 95 allows comments (beginning with !) in namelist input data. Compaq Fortran previously provided this feature as a language extension.