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

Bill Long longb
Fri Feb 12 19:38:03 EST 2010

Tobias Burnus wrote:
> 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)] 

Yes, this is my interpretation.

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
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101

More information about the J3 mailing list