Hi Alexandre,
On Apr 6, 2023, Bernhard Reutner-Fischer <rep.dot....@gmail.com> wrote:
29 For C_BOOL, the internal representation of .TRUE._C_BOOL and
.FALSE._C_BOOL shall be the same as those of
30 the C values (_Bool)1 and (_Bool)0 respectively.
I'm not changing any of the standard types, FWIW. The proposed
extension enables alternate boolean types to be introduced, with
extra checking for hardening.
I personally like your proposed 0 and ~0, that's probably pretty robust.
That is only a default. Certain applications may benefit from other
values. 0xa5 and 0x5a seem to make a good combination too.
In gfortran, we depend on the representation of 0/1 for several things
(among them avoiding having separate library versions for logical
kind=1,2,4,8,16 for MASK).
So, such a type would be incompatible with vanilla LOGICAL variables
and with C interop logical variables.
If anybody should pass such a hardbool variable to Fortran, they
will get unpredictable results, and deserve to lose. The opposite
effect of what would be intended :-)
Best regards
Thomas