I am working on integration of C program with Fortran subroutines - using C/Fortran interoperability (ISO_C_BINDING). When I pass single precision array from C to Fortran subroutine can I be ALWAYS sure that C_FLOAT is the same as REAL*4. So in other words inside Fortran procedure I want to use values of passed array (via pointer) and do not want to copy elements from C_FLOAT array to REAL*4 array (then conversion is - as I assume - automatic between these two) ?
- REAL*4 isn't standard Fortran - it is an extension.
- The C standard does not require a float be four bytes.
- You could potentially have different forms of floating point representation with the same byte count.
Although "real*4" and C_FLOAT are physically the same on Intel platforms, in some contexts where both are visible to the compiler, the equivalence may not be recognized. Companion compilers may not be implemented with equality among C_FLOAT, selected_real_kind(6), and REAL32, even on a platform where all refer to the same floating point format.