In order to ensure that exactly the same variable type and kind is used in C and Fortran, the named constants shall be used which are defined in the ISO_C_BINDING
intrinsic module. That module contains named constants for kind parameters and character named constants for the escape sequences in C. For a list of the constants, see ISO_C_BINDING.
For logical types, please note that the Fortran standard only guarantees interoperability between C99's _Bool
and Fortran's C_Bool
-kind logicals and C99 defines that true
has the value 1 and false
the value 0. Using any other integer value with GNU Fortran's LOGICAL
(with any kind parameter) gives an undefined result. (Passing other integer values than 0 and 1 to GCC's _Bool
is also undefined, unless the integer is explicitly or implicitly casted to _Bool
.)
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gfortran/Intrinsic-Types.html