 |
» |
|
|
 |
The following summarizes features of Fortran 90 that
are not in standard FORTRAN 77 and indicates where they
are described in this manual. Source format |  |
The fixed source form of FORTRAN 77 is extended by
the addition of the semicolon (;) statement separator and the exclamation
point (!) trailing
comment. HP Fortran 90 also supports free format source code. The format
used in a source program file is normally indicated by the file
suffix, but the default format can be overridden by the +source
compile-line option. For information about source format, see “Source format of program
file”. Data types |  |
Data declarations can
include a kind type parameter—an integer value that determines
the range and precision of values for the declared data object.
The kind type parameter value is the number of bytes representing
an entity of that type, except for COMPLEX
entities, where the number of bytes required is double the kind
type value. In principle, multibyte character data for languages with
large character sets can be implemented in Fortran 90 by means of
a kind type parameter for the CHARACTER
data type. HP Fortran 90, however, uses the Extended
Unix Code (EUC) characters in file names, comments, and string literals. Fortran 90 supports derived types, which are composed
of entities of the intrinsic types (INTEGER,
REAL, COMPLEX,
LOGICAL, and
CHARACTER) or
entities of previously defined derived types. You declare derived-type
objects in the same way that you declare intrinsic-type objects.
For information about intrinsic and derived types, see “Intrinsic data types” and “Derived types”. Pointers |  |
Pointers are variables that contain addresses of other variables
of the same type. Pointers are declared in Fortran 90 with the POINTER
attribute. A pointer is an alias, and the variable
(or allocated space) for which it is an alias is its target.
The pointer enables data to be accessed and handled dynamically.
For more information, see “Pointers”. Arrays |  |
The Fortran 90 standard has defined these new array features: Array sections that permit
operations for processing whole arrays or a subset of array elements;
expressions, functions, and assignments can be array-valued. The
WHERE construct
and statement are used for masked-array assignment. Array constructors—unnamed, rank-one arrays
whose elements can be constants or variables. You can use the RESHAPE
intrinsic function to transform the array constructor to an array
value of higher rank. New types of array: Assumed-shape arrays are dummy arguments
that take on the size and shape of the corresponding actual arguments. Deferred-shape arrays become defined when they are
associated with target array objects. Automatic arrays have at least one bound that is
not a constant.
Arrays are discussed in Chapter 4 “Arrays”. Control constructs |  |
Control constructs The CASE
construct selects and executes one or more associated statements
on the basis of a case selector value, which can be of type INTEGER,
CHARACTER or LOGICAL. Additional forms of the DO
statement allow branching to the end of a DO
loop and branching out of a DO
loop.
These constructs are described in “Control constructs and statement blocks”. Operators |  |
You can write your own procedures to define new operations
for intrinsic operators, including assignment, for use with operands
of intrinsic data types or derived data types; see “Defined operators” and “Defined assignment”. Procedures |  |
Fortran 90 includes a
feature called the procedure interface block,
which provides an explicit interface for external procedures. The
names and properties of the dummy arguments are then available to
the calling procedure, allowing the compiler to check that the dummy
and actual arguments match. For information about interface blocks,
see “Procedure interface”. Actual arguments can be omitted from the argument
list or can be arranged in a different order from the dummy arguments. You can implement user-defined operators or extend
intrinsic operators, including the assignment operator; see “Defined operators” and “Defined assignment”. Dummy arguments to procedures can be given an INTENT
attribute (IN,
OUT or INOUT);
see “INTENT attribute”. Subprograms can appear within a module subprogram,
an external subprogram, or a main program unit; see “Internal procedures”. Recursive procedures (an extension in HP FORTRAN 77)
are a standard feature of Fortran 90. For more information,
see “Recursive reference”.
Modules |  |
A module is a program unit that can be used to specify data
objects, named constants, derived types, procedures, operators,
and namelist groups. Partial or complete access to these module
entities is provided by the USE
statement. An entity may be declared PRIVATE
to limit visibility to the module itself. One use of the module is to provide controlled access to global
data, making it a safer alternative to the COMMON block. The module
also provides a convenient way to encapsulate the specification
of derived types with their associated operations. For information about modules, see “Modules”. I/O features |  |
Nonadvancing I/O After a record-based I/O operation in FORTRAN 77,
the file pointer moves to the start of the next record. In Fortran 90,
you can use the ADVANCE=NO
specifier to position the file pointer after the characters just
read or written rather than at the start of the next record. Nonadvancing
I/O thus allows you to determine the length of a variable-length
record. See “Nonadvancing I/O”
for more information. Namelist-directed I/O Namelist-directed I/O—previously available
as an extension to FORTRAN 77—is a standard feature
of Fortran 90. This feature enables you to perform repeated
I/O operations on a named group of variables. See “Namelist-directed I/O” for more information.
Intrinsics |  |
Fortran 90 provides a large number of new intrinsic procedures
for manipulating arrays. Many of them are elemental, taking either
scalar or array arguments. In the latter case, the result is as
if the procedure were applied separately to each element of the
array. Other additions include transformational functions that operate
on arrays as a whole, and inquiry functions that return information
about the properties of the arguments rather than values computed
from them. Table 4-1 “Array
inquiry intrinsic functions” lists
the array-inquiry intrinsic functions. For descriptions of all intrinsic
procedures, see Chapter 11 “Intrinsic procedures”.
|