In standard FORTRAN or Fortran, logical expression operands can be evaluated in any order. An incomplete assessment is permitted, but a specific implementation.
This allows you to optimize logical expressions that would not be resolved if strict ordering were observed from left to right. Expressions requiring strict ordering must be decomposed into separate conventions or assumptions may be made depending on implementation.
Since decomposition is used to provide ordering, it follows that individual IF statements cannot always be optimized into a single expression. However, short circuit assessment is explicit with decomposition, and it is never worse than languages that provide strict ordering from left to right to give a lazy assessment.
Languages that are derived from FORTRAN (Fortran, BASIC, VBn) and languages that were designed to achieve performance similar to FORTRAN (Pascal, Ada) initially corresponded to the FORTRAN example, which allows out-of-order evaluation.
david Mar 17 2018-11-15T00: 00Z
source share