Re: [MPI3 Fortran] Fwd: [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind
On Feb 28 2013, Tobias Burnus wrote:
(a) LOGICAL(C_Bool) This is interoperable with C99 _Bool and defined within the standard. (One can argue how well-defined it is, esp. on the C99 side.)
I think that it's truly horrible, as is anything to do with _Bool.
(b) Using INTEGER(C_INT) That matches the C version's "int", but requires to use integers for Boolean purposes and is odd with the the non-MPI_F08 version.
Yes, but it's portable and reliable.
(c) Using LOGICAL without BIND(C) That surely works, but it makes the work for the MPI implementation much harder. Without BIND(C), there is no defined C interface and the implementation has to be compiler specific. Especially for dimension(..) and for passing characters (scalar, array, allocatable/pointer or neither), different compilers will handle them differently.
No, it doesn't have to be. It is easy to write a portable interface that calls the C.
(d) LOGICAL(C_INT) This proposal requires a change of Fortran standard; It effectively matches the current MPI 3 spec. For compilers which implement LOGICAL internally as INTEGER, it is probably fine. However, some compilers don't, e.g. GCC's and NAG's.
Probably no chance, and certainly not in that form. C_BOOL_INT is technically possible, but I doubt that J3/WG5 would approve.
* Has someone an additional proposal?
Yes. (e) Drop ALL of the BIND(C) from the functions, as they aren't currently conforming. Plain INTEGER is not guaranteed to be interoperable, and nor is DOUBLE PRECISION (Wtime, Wtick). I hope to make default types more interoperable in the next standard, but that hasn't even been discussed yet. My order is (e), (b), (c), (a) and (d). Regards, Nick Maclaren.
participants (1)
-
N.M. Maclaren