Download PVF User's Guide

Transcript
arrays start at 0 and Fortran arrays start at 1. A Fortran array can be declared to start at zero.
Another difference between Fortran and C/C++ arrays is the storage method used. Fortran uses
column-major order and C/C++ use row-major order. For one-dimensional arrays, this poses no
problems. For two-dimensional arrays, where there are an equal number of rows and columns, row
and column indexes can simply be reversed. Inter-language function mixing is not recommended for
arrays other than single dimensional arrays and square two-dimensional arrays.
Structures, Unions, Maps, and Derived Types.
Fields within Fortran structures and derived types, and multiple map declarations within a Fortran
union, conform to the same alignment requirements used by C structures.
Common Blocks.
A named Fortran common block can be represented in C/C++ by a structure whose members
correspond to the members of the common block. The name of the structure in C/C++ must have the
added underscore. For example, the Fortran common block:
INTEGER I, J
COMPLEX C
DOUBLE COMPLEX CD
DOUBLE PRECISION D
COMMON /COM/ i, j, c, cd, d
is represented in C with the following equivalent:
extern struct {
int i;
int j;
struct {float real, imag;} c;
struct {double real, imag;} cd;
double d;
} com_;
and in C++ with the following equivalent:
extern "C" struct {
int i;
int j;
struct {float real, imag;} c;
struct {double real, imag;} cd;
double d;
} com_;
Note that the compiler-provided name of the BLANK COMMON block is implementation specific.
170
Run-time Environment