[MPI3 Fortran] Fwd: [Mpi-comments] MPI 3.0: Fortran 2008 interface - issue with the LOGICAL kind

N.M. Maclaren nmm1 at cam.ac.uk
Fri Mar 1 02:57:58 CST 2013


On Feb 28 2013, Bill Long wrote:
>
>In C when any scalar value is converted to _Bool, the result is 0 if the 
>value compares equal to 0; otherwise the result is 1.  (6.3.1.3 Boolean 
>type).

But not necessarily when a value is stored in it :-(  One of the many
things that the UK disliked about _Bool was this deceptive aspect;
the C standard is massively ambiguous about whether _Bool data can be
used for integers in the range 2-127.

>The value of C_BOOL as a Fortran KIND type for LOGICAL is such that
>
>1) The bitsize of LOGICAL(C_BOOL) matches the bitsize of _Bool in C for 
>the companion processor.
>
>2) The Fortran processor uses the internal bit pattern in LOGICAL 
>(C_BOOL) of 0 to represent false, and 1 to represent true.

Does it?  I can't find that in the Fortran standard.  Either I have
missed it, or this is a wart that we should consider for the next
revision.


Regards,
Nick Maclaren.




More information about the mpiwg-fortran mailing list