(j3.2006) Interpretation question Fortran 2003: Interoperability of COMMON with C

Tobias Burnus burnus
Thu Feb 11 11:19:03 EST 2010


Hello,

how to read the following quote - more precisely: How to read the "or" -
as exclusive or not?

F2003, 15.3: "A C variable with external linkage interoperates with a
common block that has been specified in a BIND statement
(1) if the C variable is of a struct type and the variables that are
members of the common block are interoperable with corresponding
components of the struct type, or
(2) if the common block contains a single variable, and the variable is
interoperable with the C variable."


Does a common block containing a single variable (e.g. of type
"integer(c_int)") need to be interoperable with the C variable ("int")
only [i.e. only (2)] or does it need to be interoperable with the C
variable ("int") _and_ with a C struct type ("struct { int ..;}")
containing the single variable [i.e. (1) _and_ (2)].

Background: Currently, the GNU C compiler regards "int a;" and "struct {
int ia; } a"; as two different types and thus a Fortran variable cannot
be interoperable with both. If the "or" is not exclusive, can someone
point me to the C 99 (or C0x) standard, where it states that "int a;"
and "struct {int ia; } a" interoperate - especially, if they are global
variables ("extern")?

Tobias



More information about the J3 mailing list