Chapter 19
Essentials of Essentials of Fortran-90/95/2003
Miscellaneous

Math 60 -- D. C. Smolarski, S.J.
Santa Clara University, Department of Mathematics and Computer Science

[Return to Math 60 Homepage | Return to Brief Contents Page]
[Return to Full Contents Page]

Contents


19.1 Obsolescent Features

The Fortran-90 standard (i.e., language definition) introduced the concept of obsolescence and some authors also speak about deprecation. These terms apply to those features that may, in fact, be removed from future revisions of Fortran (i.e., no longer included in future "standards") or have been rendered unnecessary. Most of these statements are no longer needed because of the introduction of newer, more versatile statements and structures, and therefore should be avoided as much as possible to conform to good programming practices. Fortran-95 and Fortran-2003 continue to list certain statements as obsolescent.

Note that compilers will continue to support obsolescent statements and features, and some new compilers may even continue to support features that have been recently removed. Future compilers, however, will not be required to support features once designated as obsolescent and then subsequently removed from the official definition of Fortran.

Fortran-90 "obsolescent" statements and features include the following:

Of these features, the following have been removed from Fortran-95 and, thus, may not be supported by Fortran-95 compilers: Newly declared "obsolescent" statements and features for Fortran-95 include the following: The following has been removed from Fortran-2003 and, thus, may not be supported by Fortran-2003 compilers: The following are mentioned as "deprecated" (or "redundant") features by certain authors. This designation has no offical status in Fortran standards but are suggestive of features that may, in fact, be eventually listed as "obsolescent." They should also be avoided in new Fortran code, since they can be replicated by newer features which can lead to code that is more easily understandable. Since many of these features are very common in older code that is still widely used, the features will probably continue to be supported in the near future.

19.2 New Fortran-95 Features

The major new features of Fortran-95 (not present in Fortran-90) include the following:

19.3 New Fortran-2003 Features

Some authors have stated that Fortran-2003 is a major revision, as was Fortran-90 (unlike Fortran-95). On the other hand, many of the additions deal with advanced features or features that would seldom be used by beginning Fortran programmers.

We briefly deal with five significant new additions to Fortran introduced with the Fortran-2003 standard: Allocatable Components of Derived Types, "Class" Variables, Function Pointers, C Interoperability, and Command Line Arguments.

19.3.1 Allocatable Components of Derived Types

The Fortran 2003 specifies that components of derived types may have an allocatable attribute. For example,
      TYPE STACK
           INTEGER :: TOP
	   INTEGER, ALLOCATABLE :: INFO(:)
      END TYPE STACK
A variable of this type (e.g., if A were declared to be of type STACK would first be declared and then the INFO component would be allocated by a statement such as
      ALLOCATE(A%INFO(M))
where M had been assigned a value before this statement.

19.3.2 "Class" Variables

The keyword CLASS may be used in place of TYPE when declaring polymorphic variables of a derived type, i.e., variables whose data type may, in fact, vary at run time. For example,
      TYPE POINT
          REAL :: X, Y
      END TYPE POINT
      CLASS(POINT), POINTER :: P
Variable P is declared to be of user declared type POINT and any of its extensions (cf. section 19.3.6 below).

19.3.3 Function Pointers

One may now declare identifiers as pointers to functions and subroutines. (This may be done in several different ways.) If, for example, FUNCPT has been declared as a pointer to a function, then it can be used in a pointer assignment statement, such as
      FUNCPT => COS

19.3.4 C Interoperability

Fortran-2003 provides a standardized mechanism for interoperation with the programming language C. Lists are available which indicate the Fortran data type and the corresponding C data type,

A program must make use of an intrisic module named ISO_C_BINDING containing predefined names which link Fortran "kind" values with corresponding C data types. For example,

       USE ISO_C_BINDING
       INTEGER(KIND=C_INT) :: M, N, I
       REAL(KIND=C_DOUBLE) :: X, Y
corresponds to declaring m, n, i to be of standard C type int and x and y to be of standard C type double. Arrays in the other language are usually declared with arguments listed in reverse order.

A programmer should consult an advanced manual about other details, such as the using Fortran procedures in C codes and invoking a C function from Fortran code.

19.3.5 Command Line Arguments

C (and C++) have always had the ability to compile a main program with run-time parameters (argc and argv), which return the run-time command line argument strings and the number of arguments. Fortran 2003 has standardized a similar feature.

19.3.6 Other Features

Fortran-2003 has included various other features including those that may be familiar to programmers who have used object-oriented concepts in C++ or similar languages. The following list give an overview of some of these new features: For other information on Fortran 2003, one should check published manuals or visit on-line information available. Recommended are English-language papers authored by John Reid, who is the convenor of the the ISO Fortran Working Group, for example

19.4 HPF

High Performance Fortran or "HPF" is a superset of Fortran-90/95. The main extension are compiler directives that begin with !HPF$. Such statements are seen as comments by other compilers, but are interpreted by HPF compilers to optimize the performance of the code on parallel machines.

HPF also includes a few additional intrinsic functions pertinent to executing code on parallel machines.

Further information about HPF should be obtained from detailed manuals for the machine being used.


This page is maintained by Dennis C. Smolarski, S.J. dsmolarski@math.scu.edu
© Copyright 1999-2005 Dennis C. Smolarski, S.J., All rights reserved.
Last changed: 29 June 2005.