[patch, fortran] Handling of .and. and .or. expressions
Thomas Koenig
tkoenig@netcologne.de
Thu Jun 14 08:38:00 GMT 2018
Am 13.06.2018 um 22:46 schrieb Dominique d'Humières:
>
>>> In addition I donât understand the associated warning: in short-circuit evaluation ASSOCIATED(m) (or ALLOCATED(m)) does protect m%T to be accessed.
>>
>> That is the whole point: Fortran does not have short circuit evaluation.
>> Very many people assume that it does (or that everything is always
>> evaluated), and this causes latent bugs.
>
> I donât understand. Short-circuit evaluation is explicitly allowed by the standard.
Also legal are:
Short-circuit evaluation in reverse order, parallel evaluation,
evaluation of both expressions in the order they appear or evaluation
of both expressions in reverse order (I think I have all cases there,
but I may have missed one :-)
The problem is that the user should not depend on it, and
a compiler is free to chose whatever is most suited.
Regards
Thomas
More information about the Fortran
mailing list