Re: [MPI3 Fortran] Fwd: [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind
On Feb 28 2013, Craig Rasmussen wrote:
I just did a quick rereading of clause 15, Interoperability with C, and it appears ill defined to me. Consider the following:
Yes. I hope to get these improved in the next standard. I have already made proposals to the UK, for consideration.
1. Suppose a compiler has a default logical size equivalent to a default integer. Since the standard only requires one logical kind, this compiler may not have a type that is interoperable with a _Bool C type. In this instance C_BOOL would be a negative value.
That is correct. That would also be the case if it were a C90 compiler not a C99 one.
2. If a compiler does support LOGICAL(kind=C_BOOL), what values of a C type _Bool map to .TRUE.? What values map to .FALSE.? These mappings may be in clause 15 but I didn't see them at first glance.
No, but an interpretation would almost certainly say that any compiler that didn't treat zero as .FALSE. and non-zero as .TRUE. is non-conforming. Malcolm or Bill might correct me, but I doubt it :-) The real question is what (integer) value does .TRUE._C_BOOL have? Regards, Nick Maclaren.
participants (1)
-
N.M. Maclaren