Notes: Fortran-2003 Key Features

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

[Return to Math 60 Homepage | Return to Notes Listing Page]

Contents


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.

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

Function Pointers

One may now declare identifiers as pointers to functions and subroutines.

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,

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.

Other References

For detailed information on Fortran 2003, also see
John Reid, "An Overview of Fortran 2003," ACM Sigplan, Vol. 39:8 (Aug 2004), pp 31-38.
John Reid, "The New Features of Fortran 2003" (38 page PDF file)

This page is maintained by Dennis C. Smolarski, S.J. dsmolarski@math.scu.edu
© Copyright 2005 Dennis C. Smolarski, SJ, All rights reserved.
Last changed: 22 February 2005.